only add user`s key to root, if sudo=yes

main
Simeon Keske 5 years ago
parent e0771d212b
commit 81b5c237b9
No known key found for this signature in database
GPG Key ID: B15B623C3C45B235

@ -33,7 +33,7 @@
state=present state=present
with_items: with_items:
- "{{ users }}" - "{{ users }}"
when: item.state != 'absent' and item.public_key is defined when: item.state != 'absent' and item.public_key is defined and item.sudo is defined and item.sudo
- name: remove user from root's authorized_keys - name: remove user from root's authorized_keys
authorized_key: user="root" manage_dir=true key="{{ item.public_key }}" authorized_key: user="root" manage_dir=true key="{{ item.public_key }}"

Loading…
Cancel
Save