From 29f7ebf14ae9a42cbdc9d94f7ba38a3d82698427 Mon Sep 17 00:00:00 2001 From: djpbessems Date: Wed, 20 Apr 2022 09:16:55 +0200 Subject: [PATCH] Switch to shell module --- playbook.yml | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/playbook.yml b/playbook.yml index 480f6fd..195d737 100644 --- a/playbook.yml +++ b/playbook.yml @@ -66,19 +66,22 @@ groups: k3s_ha with_items: "{{ nodes }}" - # - name: Scan public keys - # ansible.builtin.shell: - # cmd: "ssh-keyscan -t rsa {{ item.ip }}" - # register: publickeys - # with_items: "{{ nodes }}" + - name: Scan public keys + ansible.builtin.shell: + cmd: "ssh-keyscan -t rsa {{ item.ip }}" + register: publickeys + with_items: "{{ nodes }}" - # - name: Store public keys - # ansible.builtin.known_hosts: - # name: "{{ item.item }}" - # key: "{{ item.stdout }}" - # state: present - # path: ~/.ssh/known_hosts - # with_items: "{{ publickeys.results }}" + - ansible.builtin.debug: + var: publickeys + + - name: Store public keys + ansible.builtin.known_hosts: + name: "{{ item.item }}" + key: "{{ item.stdout }}" + state: present + path: ~/.ssh/known_hosts + with_items: "{{ publickeys.results }}" - name: Provision Kubernetes hosts: k3s_ha