Hi
I have a playbook whereby I pass variables in such as install_office ==
'y', and I have tasks where it would only include_tasks for a task file to
install Office (for example) when install_office == 'y'
eg.
tasks:
- name: Install Office
include_tasks: installoffice.yml
when: install_office == 'y'
And when I did not want Office installed, I needed to explicitly define a
variable to install_office == 'n' (or anything else other than y would work
as well), else Ansible tells me that install_office variable is not defined.
How can I set it so that if I do not define the variable, it will default
to 'n'? Right now I am using include_vars: to include a file defining each
of the variables, and for each variable, I set it as 'y' or 'no' based on
whether I want to include the task to my main playbook or not. It would be
more simpler if I can just define the ones I want to include as 'y' and let
everything else that my playbook expects but is not defined to be set to
'n'.
Please let me know what I can do? Thanks!!
--
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/3818cd43-a9b3-4f6c-9230-3ca941e557e7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.