I have a task that sends a reboot command to a host, then pings every
10-seconds until a ping has failed. This indicates the hosts has begun the
reboot and moves on the a ping every 60-seconds waiting for a ping success
indicating the host is back up. It works fine with no issues. The only
thing is the fatal output when the ping fails, I would like to stop this
from displaying. i have no_logs: true and ignore_errors set already, but
can not figure out how to stop the output.
*The code snippet:*
- name: Pause for Reboot to Begin. Checking Every 10-Seconds for Ping
Failure.
local_action: raw ping -c 1 -W 1 {{vars[inventory_hostname].IP_Address}}
register: output
until: output.stdout.find("0 received") != -1
retries: 12
delay: 10
ignore_errors: true
- name: Waiting for Reboot to Complete. Checking Every 60-Seconds for Ping
Success.
local_action: shell ping -c 1 {{vars[inventory_hostname].IP_Address}}
register: result
until: result.stdout.find("64 bytes from") != -1
retries: 15
delay: 60
ignore_errors: true
*The tasks output, want to suppress the red:*
TASK [base_config_oam : Send Reboot Command]
***************************************************************************************
changed: [vsrx-01]
TASK [base_config_oam : Pause for Reboot to Begin. Checking Every
10-Seconds for Ping Failure.] ************************************
FAILED - RETRYING: Pause for Reboot to Begin. Checking Every 10-Seconds for
Ping Failure. (12 retries left).
FAILED - RETRYING: Pause for Reboot to Begin. Checking Every 10-Seconds for
Ping Failure. (11 retries left).
FAILED - RETRYING: Pause for Reboot to Begin. Checking Every 10-Seconds for
Ping Failure. (10 retries left).
FAILED - RETRYING: Pause for Reboot to Begin. Checking Every 10-Seconds for
Ping Failure. (9 retries left).
FAILED - RETRYING: Pause for Reboot to Begin. Checking Every 10-Seconds for
Ping Failure. (8 retries left).
FAILED - RETRYING: Pause for Reboot to Begin. Checking Every 10-Seconds for
Ping Failure. (7 retries left).
fatal: [vsrx-01 -> localhost]: FAILED! => {"censored": "the output has been
hidden due to the fact that 'no_log: true' was specified for this result"}
STDOUT:
PING 192.168.1.209 (192.168.1.209) 56(84) bytes of data.
--- 192.168.1.209 ping statistics ---
1 packets transmitted, 0 received, 100% packet loss, time 0ms
MSG:
non-zero return code
...ignoring
TASK [base_config_oam : Waiting for Reboot to Complete. Checking Every
60-Seconds for Ping Success.] *******************************
FAILED - RETRYING: Waiting for Reboot to Complete. Checking Every
60-Seconds for Ping Success. (15 retries left).
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/fbf4a6f7-d498-4a36-bc8b-5785b76c36f2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.