From b1b03f0dc0dbf7844fe6c989498399e89bca38ab Mon Sep 17 00:00:00 2001 From: Mohammed Naser Date: Fri, 29 Apr 2022 23:15:47 -0400 Subject: [PATCH] Add SSH key to execturo Change-Id: I7e39a1c7e46312346f73d17711f552c8e10f9301 --- playbooks/molecule/pre-run.yaml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/playbooks/molecule/pre-run.yaml b/playbooks/molecule/pre-run.yaml index b5d14c9..e2d1c87 100644 --- a/playbooks/molecule/pre-run.yaml +++ b/playbooks/molecule/pre-run.yaml @@ -33,6 +33,21 @@ src: "{{ ansible_user_dir }}/.cache/molecule/{{ zuul.project.short_name }}/default/instance_config.yml" register: _molecule_instance_config + - name: Grab the Molecule SSH key + slurp: + src: "{{ ansible_user_dir }}/.cache/molecule/{{ zuul.project.short_name }}/default/id_rsa" + register: _molecule_ssh_key + + - name: Copy the SSH key down to exector + fetch: + src: "{{ ansible_user_dir }}/.cache/molecule/{{ zuul.project.short_name }}/default/id_rsa" + dest: "{{ ansible_user_dir }}/.ssh/id_molecule" + flat: yes + + - name: Add SSH key to the executor + delegate_to: localhost + command: ssh-add {{ ansible_user_dir }}/.ssh/id_molecule + - name: Add all of the hosts to the inventory add_host: name: "{{ item.instance }}"