Skip to content
Snippets Groups Projects

Add marija, allow multiple SSH keys per user

Merged Karel van Klink requested to merge add-marija into main
2 files
+ 33
16
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -7,19 +7,21 @@
- name: Add Linux users
ansible.builtin.user:
name: "{{ item.username }}"
comment: "{{ item.full_name }}"
name: '{{ item.username }}'
comment: '{{ item.full_name }}'
create_home: yes
groups: sudo
append: yes
password: '!' # Do not allow login with a password
password_lock: yes # Login with SSH key only
shell: "{{ item.shell }}"
shell: '{{ item.shell }}'
register: user_output
with_items: "{{ goat_users }}"
with_items: '{{ goat_users }}'
- name: Add SSH key to user for logging in
ansible.posix.authorized_key:
user: "{{ item.username }}"
key: "{{ item.ssh_key }}"
with_items: "{{ goat_users }}"
user: '{{ item.0.username }}'
key: '{{ item.1 }}'
with_subelements:
- '{{ goat_users }}'
- ssh_keys
Loading