diff --git a/fr/pglift/ansible/playbooks/roles/ssh-exchange/tasks/main.yml b/fr/pglift/ansible/playbooks/roles/ssh-exchange/tasks/main.yml index b6f8c05..200999d 100644 --- a/fr/pglift/ansible/playbooks/roles/ssh-exchange/tasks/main.yml +++ b/fr/pglift/ansible/playbooks/roles/ssh-exchange/tasks/main.yml @@ -14,12 +14,12 @@ - name: Fetch the public key files fetch: src: "~{{ username }}/.ssh/id_rsa.pub" - dest: "/tmp/{{ansible_hostname}}-id_rsa.pub" + dest: "/tmp/{{inventory_hostname}}-id_rsa.pub" flat: yes - name: Add the keys to authorized_keys ansible.posix.authorized_key: user: "{{ username }}" key: "{{ lookup('file','/tmp/{{item}}-id_rsa.pub')}}" - when: "item != ansible_hostname" + when: "item != inventory_hostname" with_items: - "{{ groups[target_group] }}" \ No newline at end of file