zuul-jobs/roles/add-build-sshkey/tasks/create-key-and-replace.yaml
Sorin Sbarnea ad3167bd56 Fixes all tasks should be named rule
This prepared for ansible-lint v5 which no longer has exceptions
for task naming, requiring all to be named.

Change-Id: I5e761d1e3836fa270d7afdcf01780320001f820d
Part-Of: #773245
2021-03-08 13:30:32 +00:00

35 lines
1.0 KiB
YAML

- name: Create Temp SSH key
command: ssh-keygen -t rsa -N '' -C 'zuul-build-sshkey' -f {{ zuul_temp_ssh_key }}
delegate_to: localhost
run_once: true
- name: Remote setup ssh keys (linux)
include_tasks: remote-linux.yaml
when: ansible_os_family != "Windows"
- name: Remote setup ssh keys (windows)
include_tasks: remote-windows.yaml
when: ansible_os_family == "Windows"
- name: Remove zuul master ssh key
import_role:
name: remove-zuul-sshkey
- name: Add back temp key
command: ssh-add {{ zuul_temp_ssh_key }}
delegate_to: localhost
run_once: true
- name: Verify we can still SSH to all nodes
ping:
when: ansible_os_family != "Windows"
- name: Verify we can still SSH to all nodes (windows)
command: ssh -o BatchMode=yes -o ConnectTimeout=10 {{ ansible_user }}@{{ ansible_host }} echo success
delegate_to: localhost
when:
- ansible_os_family == "Windows"
# Only run if we successfully configured the host. If not the host doesn't support
# ssh and the check shall not break them.
- windows_remote_ssh is succeeded