The correct pattern would be: when: foo is defined and foo
On Fri, Jul 25, 2014 at 3:29 PM, Michael Dur <[email protected]> wrote: > I've discovered two things I'll post here: > > 1. For the time being you can toggle failing on undefined variables in the > ansible config > > 2. It is better to use 'is defined' or 'is not defined' rather than > comparison in this use case. > > > On Friday, July 25, 2014 3:04:28 PM UTC-4, Michael Dur wrote: >> >> I have a role which is just a meta playbook for installing many packages. >> I only want these to run once during an ansible run since interacting >> with the package manager is slow. >> I thought I'd register a variable and check it, however I'm getting an >> error. >> >> TASK: [feature/zypper | remove non-seas repos] >> ******************************** >> fatal: [tr808.seas.upenn.edu] => error while evaluating conditional: ( >> common_has_executed == 'false') >> >> Here the relevant files: >> >> common/tasks/main.yml >> --- >> - name: log common status >> set_fact: common_has_executed = 'true' >> >> common/meta/main.yml >> --- >> allow_duplicates: no >> dependencies: >> >> - { role: feature/rc.firewall, when: ( common_has_executed == 'false') } >> - { role: feature/perl, when: ( common_has_executed == 'false') } >> - { role: feature/python, when: ( common_has_executed == 'false') } >> - { role: feature/ruby, when: ( common_has_executed is == 'false') } >> > -- > 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/a6232724-68f4-4de6-84b8-13c26e090219%40googlegroups.com > <https://groups.google.com/d/msgid/ansible-project/a6232724-68f4-4de6-84b8-13c26e090219%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/CA%2BnsWgw09%3DFztPz%3DKXYGjGDPQKBVqCcZ9R8TWqX-rb5Radv3zg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
