Hi Team,

I have started working on Ansible from last 2-3 months only, so not able to 
remember all module by heart. I did setup one env variable (result) and 
then based on that value I am trying to call the role and playbook is 
importing. Below is the code for the same

*- hosts: all *
*gather_facts: yes *

*roles: *
* - role: add_post_patch_motd*
*   when: result.user_input == "YES"*
* - role: qradar_install/post_install/python_setup*
*   when: result.user_input == "YES" *

*- import_playbook: iso.yml*
*  when: result.user_input == "YES"*
*- import_playbook: post_patch_setup.yml*
*  when: result.user_input == "YES"*
*- import_playbook: post_patch_commands.yml*
*  when: result.user_input == "YES" *

*- import_playbook: remove_old_tls.yml*
*  when: result.user_input == "YES"*

Here I am using same when condition to call role and import_playbook, which 
is somewhat like a duplication of code. I got to know that blocks can be 
used via task, so cannot used here. Used looping too, but not able to 
figure out exact way. There is one failed_when parameter, I tried to use it 
with one role to call, so that if it gets failed, all other statement will 
get skip, but it doesn't worked for me. I wanted that for result value, 
other than "YES" it should skip any other statement in playbook.

Could you please help me how to use the same here

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/fcf22986-9c3c-413d-836e-5fe85fc56a65n%40googlegroups.com.

Reply via email to