Hi,
I have an ansible task that includes the reboot model.
In my environment I have 16 servers, When I run the playbook it looks that all 16 servers were rebooted, but the playbook hang after the last reported server. I needed to use CTRL + C in order to release the shell
I did the same test with 8 servers and everything worked fine and the playbook was finished usefully.
Please note that i have both virtual and physical servers
PlayBook
server reboot
- hosts:
- bare_metal_servers
- virtual_servers
become: true
gather_facts: False
tasks:
-
name: Server reboot
reboot: -
name: Verify that all hosts are reachable
ping:
Partial output: In the output, I can see all my servers but the playbook hang on the last server
<10.201.55.103> (0, ‘’, ‘’)
changed: [10.201.55.103] => {
“changed”: true,
“elapsed”: 260,
“rebooted”: true
}
reboot: attempting to get system boot time
<10.201.55.18> ESTABLISH SSH CONNECTION FOR USER: root
<10.201.55.18> SSH: EXEC sshpass -d14 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o ‘User=“root”’ -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/9c5302c865 -tt 10.201.55.18 ‘/bin/sh -c ‘"’“‘cat /proc/sys/kernel/random/boot_id && sleep 0’”’“‘’
<10.201.55.18> (0, ‘da1a1c32-ec20-43bc-b3d5-f2de90c2a5a1\r\n’, ‘Shared connection to 10.201.55.18 closed.\r\n’)
reboot: attempting post-reboot test command
<10.201.55.18> ESTABLISH SSH CONNECTION FOR USER: root
<10.201.55.18> SSH: EXEC sshpass -d14 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o ‘User=“root”’ -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/9c5302c865 -tt 10.201.55.18 '/bin/sh -c '”‘“‘whoami && sleep 0’”’“‘’
<10.201.55.18> (0, ‘root\r\n’, ‘Shared connection to 10.201.55.18 closed.\r\n’)
reboot: system successfully rebooted
<10.201.55.18> ESTABLISH SSH CONNECTION FOR USER: root
<10.201.55.18> SSH: EXEC sshpass -d14 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o ‘User=“root”’ -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/9c5302c865 10.201.55.18 '/bin/sh -c '”‘“‘rm -f -r /root/.ansible/tmp/ansible-tmp-1587634092.84-210163948610261/ > /dev/null 2>&1 && sleep 0’”’"‘’
<10.201.55.18> (0, ‘’, ‘’)
changed: [10.201.55.18] => {
“changed”: true,
“elapsed”: 31,
“rebooted”: true