zuul-jobs/roles/multi-node-known-hosts/tasks/main.yaml
Albin Vass 9062289151 Check for loop_control in with_ type loops
Change-Id: I191265df7709a6262b44a428d78fe28ffaeb4b75
2020-05-01 13:45:34 +02:00

22 lines
656 B
YAML

- name: Get known_hosts facts
generate_all_known_hosts:
hostvars: "{{ hostvars }}"
- name: add known_host record for every public key of every other ip, hostname for ansible_user
known_hosts:
name: "{{ zj_known_host.name }}"
key: "{{ zj_known_host.key }}"
with_items: "{{ ansible_facts.all_known_hosts }}"
loop_control:
loop_var: zj_known_host
- name: add default known_host record for every user
become: true
known_hosts:
name: "{{ zj_known_host.name }}"
key: "{{ zj_known_host.key }}"
path: /etc/ssh/ssh_known_hosts
with_items: "{{ ansible_facts.all_known_hosts }}"
loop_control:
loop_var: zj_known_host