I am currently using Ansible to provision bare metal using an IPv6 link local address. Once the servers are provisioned, ansible will run a series of tests on the server, as one shell command, to ensure provisioning was successful. These tests take approximately 10 minutes to run.
The issue that I'm facing is that the connection seems to timeout before the command completes.
Here is the error from Ansible:
fatal: [fe80::5054:ff:XXXX:XXXX%eth0]: UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: Shared connection to fe80::5054:ff:XXXX:XXXX%eth0 closed.\r\n",
"unreachable": true
}
By looking at this error, one might think there is an issue with the SSH connection. The SSH connection itself is good since several other tasks run successfully on the same host prior to this task.
How can I increase the timeout so that Ansible will wait for the command to finish? Can this timeout be increased within the Ansible configuration, or do I need to modify the command itself to increase the timeout?
You're going to want to run the task asynchronously. High-level steps would be:
here's an example of this behaviour from the official docs
- name: 'YUM - fire and forget task'
yum:
name: docker-io
state: installed
async: 1000
poll: 0
register: yum_sleeper
- name: 'YUM - check on fire and forget task'
async_status:
jid: "{{ yum_sleeper.ansible_job_id }}"
register: job_result
until: job_result.finished
retries: 30
delay: 10
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With