diff --git a/tasks/main.yml b/tasks/main.yml index 2d12541..a912342 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -55,8 +55,8 @@ with_items: "{{ users.keys() }}" - name: ssh authorized keys - copy: - content: "{{ users[item].authorized_keys }}" + template: + src: ssh_authorized_keys.j2 dest: "{{ users[item].home | default('/home/'+item) }}/.ssh/authorized_keys" owner: "{{ item }}" group: "{{ item }}" diff --git a/templates/ssh_authorized_keys.j2 b/templates/ssh_authorized_keys.j2 new file mode 100644 index 0000000..74fcb57 --- /dev/null +++ b/templates/ssh_authorized_keys.j2 @@ -0,0 +1,3 @@ +{% for key in users[item].authorized_keys %} +{{ key }} +{% endfor %}