Skip to content
Snippets Groups Projects
Commit 9e39b17b authored by nimrod's avatar nimrod
Browse files

- Keep idempotency.

parent adb25487
No related branches found
No related tags found
No related merge requests found
......@@ -63,8 +63,7 @@
IdentityFile /etc/ssh/deploy.key
- name: Get hosts keys
with_items: '{{ deploy_key_repos }}'
command: ssh-keyscan -H {{ item }}
command: ssh-keyscan {{ deploy_key_repos|join(' ') }}
register: deploy_key_ssh_keyscan
changed_when: False
failed_when: deploy_key_ssh_keyscan|failed or deploy_key_ssh_keyscan.stdout == ""
......@@ -72,11 +71,11 @@
check_mode: no
- name: Add known hosts
with_items: '{{ deploy_key_ssh_keyscan.results }}'
with_items: '{{ deploy_key_ssh_keyscan.stdout_lines }}'
known_hosts:
key: '{{ item.stdout }}'
key: '{{ item }}'
state: present
name: '{{ item.item }}'
name: '{{ item|split()[0] }}'
path: /etc/ssh/ssh_known_hosts
- name: Set premissions for the known hosts file
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment