A
A
Artem Kiryanov2020-09-15 16:14:58
Ansible
Artem Kiryanov, 2020-09-15 16:14:58

How to restart the server using Ansible if the status in stdout is FAILED?

I am doing the role, I need Ansible to restart the server if, when executing the command, at least one element in the status is FAILED.
The command itself displays a small table:
NAME | STATUS
module FAILED

Code:
- name: debug
debug:
msg: command.stdout_lines

This code prints the big picture. I didn't find anything in the documentation. I will be glad if you can help.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
MaxKozlov, 2020-09-15
@hacker342

Something like

...
reboot:
...
when: "'FAILED' in status.stdout"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question