ansible-roles/ssh-keys/tasks/non-root-ssh-keys.yml

20 lines
536 B
YAML

---
- name: Install the ssh keys for non root users
authorized_key: user={{ item.0.name }} key="{{ item.1 }}" state=present
when:
- non_root_users
with_subelements:
- ssh_users_list
- authorized_keys
tags: [ "pubkeys", "ssh_keys" ]
- name: Remove obsolete ssh keys if there are any
authorized_key: user={{ item.0.name }} key="{{ item.1 }}" state=absent
when:
- obsolete_ssh_key is defined
- non_root_users
with_subelements:
- ssh_users_list
- authorized_keys
tags: [ "pubkeys", "ssh_keys" ]