I'm having some trouble with executing this one task on my host. Basically i used a shell module and i want the playbook to exit when that task reports an error. Here is my code, basically it will show a json type of data like "name":"connector1","connector":{"state":"RUNNING:} etc. I want the task to fail when i see error in the out or 404. I tried executing this and the task is actually passing when it should be failing, any ideas? I'm using register and failed when
- name: 'Verify if the kafka instance is up and running'
shell: curl -X GET localhost:8080/Connector/status
args:
executable: /bin/bas
register: command_result
failed_when: "'error' in command_result.stderr" or "'404' in command_result.stderr" or "'fail' in command_result.stderr"
question from:
https://stackoverflow.com/questions/65927506/how-to-fail-a-task-and-exit-the-playbook 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…