From 90eb2bd7603aee451efaf1031a82e962a2d30a91 Mon Sep 17 00:00:00 2001 From: Pablo Rodriguez Nava Date: Tue, 10 Oct 2023 10:40:47 +0200 Subject: [PATCH] Move ssh-keyscan to zuul pre playbook As we now need to connect to each host from the controller we need to ensure from the very beggining that we are able to SSH each node since start. --- ci/playbooks/multinode-customizations.yml | 13 +++++++++++++ .../hooks/playbooks/fetch_compute_facts.yml | 18 ------------------ 2 files changed, 13 insertions(+), 18 deletions(-) diff --git a/ci/playbooks/multinode-customizations.yml b/ci/playbooks/multinode-customizations.yml index 01b8f430d0..a6c6ea9532 100644 --- a/ci/playbooks/multinode-customizations.yml +++ b/ci/playbooks/multinode-customizations.yml @@ -102,6 +102,19 @@ - make state: present + - name: Ensure we know compute host keys + ansible.builtin.shell: + cmd: | + ssh-keyscan {{ hostvars[item].ansible_host }} >> ~/.ssh/known_hosts + loop: >- + {{ + hostvars | dict2items | + selectattr("value.ansible_host", "defined") | + map(attribute="key") + }} + loop_control: + label: "{{ item }}" + - name: Generate an ssh keypair ansible.builtin.command: cmd: ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519 -P '' diff --git a/ci_framework/hooks/playbooks/fetch_compute_facts.yml b/ci_framework/hooks/playbooks/fetch_compute_facts.yml index 73a06bcc11..0a8571b899 100644 --- a/ci_framework/hooks/playbooks/fetch_compute_facts.yml +++ b/ci_framework/hooks/playbooks/fetch_compute_facts.yml @@ -1,22 +1,4 @@ --- -- name: Gather ssh host keys hook - hosts: localhost - gather_facts: false - connection: local - tasks: - - name: Ensure we know compute host keys - ansible.builtin.shell: - cmd: | - ssh-keyscan {{ hostvars[item].ansible_host }} >> ~/.ssh/known_hosts - loop: >- - {{ - hostvars | dict2items | - selectattr("value.ansible_host", "defined") | - map(attribute="key") - }} - loop_control: - label: "{{ item }}" - - name: Push repositories hook hosts: all,!crcs,!crc gather_facts: true