Conditions on include don't apply to the include itself, it is applied to the tasks included On Nov 4, 2014 1:00 PM, "jack" <[email protected]> wrote:
> I have problem at conditional include playbook: > > For example, I am following three simple playbooks: > > playbook0.yml: > --- > - hosts: test-servers > tasks: > > - debug: msg="incude playbook0.yml" > > playboo1.yml: > --- > - hosts: test-servers > tasks: > > - debug: msg="incude playbook1.yml" > > playbook.yml: > --- > > - include: playbook0.yml > when: run0 == 'true' > > - include: playbook1.yml > when: run1 == 'true' > > I try to run my playbook: > ansible-playbook -i hosts playbook.yml --extra-vars="run1=true run0=false" > > But it looks like the condition is not working. playbook0 and playbook1 > are always included no matter what condition I set. What I did wrong? Is it > possible to include another playbook conditionally? > > Thanks > Jack > > -- > 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 post to this group, send email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/5e7cb3ae-0ba5-4e5b-8b7d-ceae56abad8e%40googlegroups.com > <https://groups.google.com/d/msgid/ansible-project/5e7cb3ae-0ba5-4e5b-8b7d-ceae56abad8e%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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 post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAJ5XC8me-dYaUj8f33ZHq3747Bk%2BsVNe6OGgJ08Xn0_jB4Zn-w%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
