Well... sort of, not really.

What happens when you "when" a role, it applies a "when" as the first
condition of every task in the role.

So I suspect you have applied the "when" to your "set_fact" :)


All the "is_executed" stuff is generally non-idiomatic, the goal of a
playbook is to allow repeated configuration, and should be written to allow
reconfiguration or reassertion of configuration reliably.

If there are steps that will fail if rerun, failed_when can be a useful
guide, as can conditionals around the stat module, but just guard those
specific parts.




On Thu, Jul 24, 2014 at 4:52 PM, Michael Dur <[email protected]> wrote:

> I have a role who's sole purpose is as a meta playbook.
> It has a bunch of includes in meta/main.yml:
> allow_duplicates: no
> dependencies:
>   - { role: feature/zypper, when: "common_has_executed is defined" }
>   - { role: feature/rc.firewall, when: "common_has_executed is defined" }
>   - { role: base/base, when: "common_has_executed is defined" }
>   - { role: feature/perl, when: "common_has_executed is defined" }
>   - { role: feature/python, when: "common_has_executed is defined" }
>   - { role: feature/ruby, when: "common_has_executed is defined" }
>
> I want this to just run once, so I made a task:
>
> - name: log common status
>   set_fact:  common_has_executed = "1"
>
> Unfortunately the task seems to be parsed before the meta includes, so
> nothing runs.
>
> --
> 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/77f77ecc-29f1-4077-9fd1-78e49dd02eec%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/77f77ecc-29f1-4077-9fd1-78e49dd02eec%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%2BnsWgyd3757C3JnT85mEHf%2BbRYLrnUh3xXO5MLBAWNEkk3xdQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to