Hi Team,
I was trying to add one condition, in which if it should failed on that particular point. So, entire playbook should stop. Below is the written playbook.
- hosts: all
gather_facts: yes
pre_tasks:
- name: Verification Step before starting the post-patch playbook
pause:
prompt: “You are starting post patch playbook on {{ansible_hostname}} \n To Continue, please enter ‘YES’”
register: result
roles:
- role: add_post_patch_motd
failed_when: result.user_input != “YES”
- role: qradar_install/post_install/python_setup
- import_playbook: patch_cleanup.yml
- import_playbook: iso.yml
- import_playbook: post_patch_setup.yml
Here, user needs to enter interactive input for the “result” variable and if entered result value is other than “YES” then role should not be called and should get failed. So, as you can see I have used failed_when condition and based on that result value, it should not call role or get failed and entire playbook should stopped running. But now, even with failed_when condition satisfy, the role (add_post_patch_motd) is getting called. Do let me know what I am missing here.