diff --git a/tasks/tunnel_keys.yml b/tasks/tunnel_keys.yml index 782f8269ba25bad7d2181e1063e2f4614ad0c731..91ff270b00eacad30d5031da5af648bf36138b4c 100644 --- a/tasks/tunnel_keys.yml +++ b/tasks/tunnel_keys.yml @@ -8,8 +8,7 @@ - name: "Distribute public key of tunnel user" authorized_key: user='{{ tunnel_user_name }}' - key="{{ pubkey.stdout }} {{ inventory_hostname }}" - path='/home/{{ tunnel_user_name }}/.ssh/fresh_auth_keys_tunnel_{{ inventory_hostname }}' - delegate_to: '{{ item }}' + key="{{ hostvars[item].pubkey.stdout }} {{ item }}" + path='/home/{{ tunnel_user_name }}/.ssh/fresh_auth_keys_tunnel_{{ item }}' with_items: '{{ groups.all }}' when: item != "localhost" and inventory_hostname != "localhost"