|
|
|
|
@ -4,22 +4,22 @@ |
|
|
|
|
- name: wait for boot |
|
|
|
|
wait_for: |
|
|
|
|
delay: 5 |
|
|
|
|
port: '{{ ansible_ssh_port|default(22) }}' |
|
|
|
|
host: '{{ ansible_ssh_host }}' |
|
|
|
|
port: '{{ host_vars[inventory_hostname].ansible_ssh_port|default(22) }}' |
|
|
|
|
host: '{{ host_vars[inventory_hostname].ansible_ssh_host }}' |
|
|
|
|
search_regex: OpenSSH|dropbear |
|
|
|
|
timeout: 300 |
|
|
|
|
delegate_to: localhost |
|
|
|
|
|
|
|
|
|
- name: test ssh connection with {{ ansible_user }} |
|
|
|
|
local_action: | |
|
|
|
|
ansible.builtin.shell |
|
|
|
|
ssh -p{{ ansible_ssh_port|default(22) }} \ |
|
|
|
|
-i {{ ansible_ssh_private_key_file }} \ |
|
|
|
|
shell: | |
|
|
|
|
ssh -p{{ host_vars[inventory_hostname].ansible_ssh_port|default(22) }} \ |
|
|
|
|
-i {{ host_vars[inventory_hostname].ansible_ssh_private_key_file }} \ |
|
|
|
|
-oStrictHostkeyChecking=no \ |
|
|
|
|
-oBatchMode=yes \ |
|
|
|
|
{{ ansible_user }}@{{ ansible_ssh_host }} echo test |
|
|
|
|
{{ host_vars[inventory_hostname].ansible_user }}@{{ host_vars[inventory_hostname].ansible_ssh_host }} echo test |
|
|
|
|
register: connection_test |
|
|
|
|
ignore_errors: yes |
|
|
|
|
delegate_to: localhost |
|
|
|
|
|
|
|
|
|
- name: set ansible_user |
|
|
|
|
set_fact: |
|
|
|
|
|