You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
962 B
YAML

---
- name: Connect - Ensure we don't have an incorrect SSH host key stored on the Ansible controller
ansible.builtin.command:
cmd: "ssh-keygen -R {{ ansible_host }}"
register: create_vm_proxmox_remove_ssh_host_key_cmd
changed_when:
- '"# Host " + ansible_host + " found" in create_vm_proxmox_remove_ssh_host_key_cmd.stdout'
when:
- create_vm_proxmox_remove_ssh_host_key | bool
delegate_to: localhost
- name: Connect - Wait for SSH to become available
ansible.builtin.wait_for:
host: "{{ ansible_host }}"
port: 22
delay: 10
timeout: 120
delegate_to: localhost
- name: Connect - Get SSH host keys
ansible.builtin.shell:
cmd: "ssh-keyscan {{ ansible_host }} >> ~/.ssh/known_hosts"
args:
executable: /bin/bash
changed_when: true
delegate_to: localhost
- name: Connect - Ensure we can connect
ansible.builtin.wait_for_connection:
connect_timeout: 10
delay: 5
sleep: 2
timeout: 120
...