From 6f0fb57ecb008acf9a5d301d27acd12c7fd81b64 Mon Sep 17 00:00:00 2001 From: Markus Katharina Brechtel Date: Wed, 13 Sep 2017 19:22:20 +0000 Subject: [PATCH] write hosts in save playbook --- tasks/main.yml | 11 ----------- tasks/save.yml | 10 ++++++++++ 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/tasks/main.yml b/tasks/main.yml index cd96ad7..66d3c7d 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -16,14 +16,3 @@ ssh_host_key_state == 'fetched' - include: save.yml - -- name: write ssh_known_hosts file - local_action: known_hosts - args: - path: "{{ playbook_dir }}/ssh_known_hosts" - name: '{{ inventory_hostname }}' - key: "{{ inventory_hostname }},{{ ssh_ip }} {{ _ssh_key_type[ssh_host_key_type] }} {{ _ssh_host_key[ssh_host_key_type] }}" - when: - not ssh_host_key_state is defined or - ssh_host_key_state == 'configured' or - ssh_host_key_state == 'scanned' diff --git a/tasks/save.yml b/tasks/save.yml index a895974..9d75290 100644 --- a/tasks/save.yml +++ b/tasks/save.yml @@ -6,3 +6,13 @@ - name: host_vars file local_action: template src=host_vars.j2 dest=host_vars/{{inventory_hostname}}/ssh_host_key.yml +- name: write ssh_known_hosts file + local_action: known_hosts + args: + path: "{{ playbook_dir }}/ssh_known_hosts" + name: '{{ inventory_hostname }}' + key: "{{ inventory_hostname }},{{ ssh_ip }} {{ _ssh_key_type[ssh_host_key_type] }} {{ _ssh_host_key[ssh_host_key_type] }}" + when: + not ssh_host_key_state is defined or + ssh_host_key_state == 'configured' or + ssh_host_key_state == 'scanned'