Hi Wojtek
The error you are getting is due to inconsistent quoting. You may also need to cast your variable. Try one of these:
- include: some_playbook.yml
when: "{{ some_variable | bool }} == True"
or shorter:
- include: some_playbook.yml
when: "{{ some_variable | bool }}"
See http://docs.ansible.com/YAMLSyntax.html#gotchas and http://docs.ansible.com/playbooks_variables.html#other-useful-filters for more details.
Regards
Tom
--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/4cb1d171-cd47-44dc-ae97-87bc7b2dc5a1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
cat hosts[localhost]127.0.0.1
cat playbook.yml---- hosts: localhost connection: local gather_facts: false tasks: - include: yes.yml tags=yes when: answer == "yes" - include: no.yml tags=no when: answer == "no"
cat yes.yml---
- name: this is the yes task command: pwd
cat no.yml---
- name: this is the no task command: pwd
ansible-playbook -i hosts playbook.yml --extra-vars="answer=yes"
--
You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/BdSIRBV2HNg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/1502eeb0-34f1-4c7d-bb7c-af37523fab88%40googlegroups.com.