" when: is_amazon" This is fine.
"whether the values of variables should be quoted?" Only if they are strings. On Mon, Mar 24, 2014 at 4:56 AM, Arie Skliarouk <[email protected]> wrote: > What is the recommended way to use "saved" conditionals? > > Something like this: > > ansible_hosts has this: > machine1 amazon=yes > > vars: > is_amazon: (amazon == "yes") > tasks: > shell: echo we are on amazon > when: is_amazon > > Can ansible treat expressions in brackets in vars: section as "saved" > conditional? E.g. evaluate it and store in the value boolean True or False? > This way the conditional loader does not need to do any lookups, just > evaluate the expression as is. > > Another question I have - whether the values of variables should be > quoted? Double or single quote? From my experience, the quotes in ansible > are treated as part of the value. > > -- > Arie > > > On Sunday, March 23, 2014 4:05:00 PM UTC+2, Michael DeHaan wrote: > >> You can't load a "saved" conditional that way (at least currently) as the >> conditional loader doesn't do recursive lookups. >> >> -- Michael >> >> On Mar 23, 2014, at 7:42 AM, Arie Skliarouk <[email protected]> wrote: >> >> The following playbook does not work properly - the action is always >> executed, why is that? >> >> --- >> - hosts: * >> vars: >> x: 5 >> y: 7 >> >> is_false1: x>y >> is_false2: x>y >> tasks: >> >> - name: either is true >> shell: echo either is true >> when: is_false1 or is_false2 >> >>> >>> -- >> 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/2ee6e2c4-a02d-4ea7-8c2b- >> f55f843de572%40googlegroups.com<https://groups.google.com/d/msgid/ansible-project/2ee6e2c4-a02d-4ea7-8c2b-f55f843de572%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/f37b3f69-72d4-4994-b2d6-f19cc42836e5%40googlegroups.com<https://groups.google.com/d/msgid/ansible-project/f37b3f69-72d4-4994-b2d6-f19cc42836e5%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/CAEVJ8QO4j4xmD4uPRB%3Ddi6qQaR4GT5eR5PThcfaYM8rYaiPvHA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
