variables - when condition not being evaluated with include statement -


i have tikitaka3.yml (main yml file) , tikitaka3a.yml (playbook included) . when prompt user variable , in tasks section when call it, so:

--- - hosts:  vars:   khan: # contents: "{{ lookup('file', '/home/imran/desktop/tobefetched/file1.txt') }}"  vars_prompt:  - name: targetenv    prompt: 1.)epc 2.)clients 3)testers    private: false    default: "1"  gather_facts: no tasks:  - name: inlude playbook tikitaka3a include: /home/khan/desktop/playbooks/tikitaka3a.yml target=umar when: targetenv.stdout|int < 2  #this statement has no effect #when: targetenv == 1  #neither statement #when: targetenc == "1"  #and neither statement have affect   #- name: stuff n stuff # task give error if not commented  #  debug: var=targetenv.stdout 

the include statement comes affect, without when condition ever being evaluated

when include ansible task file attach when: condition included tasks. means see tasks displayed when when: condition false though tasks skipped.

one problem code above targetenv.stdout, here working version proper formatting:

- hosts:   gather_facts: no   vars_prompt:     - name: targetenv       prompt: 1.)epc 2.)clients 3)testers       private: false       default: "1"    tasks:     - name: inlude playbook tikitaka3a       include: roles/test/tasks/tikitaka3a.yml target=umar       when: targetenv|int < 2 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -