Ok, please file a bug about this, that the when statements need to be
propagated to the role deps.

Thanks!



On Wed, Sep 24, 2014 at 12:41 PM, E.C. Raymond <lowl...@gmail.com> wrote:

> Hi Michael,
>
> I am using 1.7.1, and tried on latest devel build.
>
> On Tuesday, September 23, 2014 6:57:02 PM UTC-7, Michael DeHaan wrote:
>>
>> For starters, can you share what version of Ansible you are using?
>>
>> Thanks!
>>
>>
>>
>> On Tue, Sep 23, 2014 at 6:24 PM, E.C. Raymond <low...@gmail.com> wrote:
>>
>>> I am experiencing some strange behavior from what I understand to be
>>> applying tags to roles/dependencies. I wrote a facts plugin to gather
>>> information about a systems role, and it includes this in the playbook
>>> run.  Each system runs a playbook on its own, only managing itself.
>>>
>>> # ansible_local facts
>>> 127.0.0.1 | success >> {
>>>     "ansible_facts": {
>>>         "ansible_local": {
>>>             "host_roles": {
>>>                 "roles": [
>>>                     "APPSERVERS",
>>>                     "COMMON",
>>>
>>>                 ]
>>>             }
>>>         }
>>>     },
>>>     "changed": false
>>> }
>>>
>>> # site.yml
>>> ---
>>>  - hosts: 127.0.0.1
>>>    connection: local
>>>    gather_facts: yes
>>>    sudo: yes
>>>
>>>    roles:
>>>      - { role: appserver,             , when: "'APPSERVERS' in
>>> ansible_local.host_roles.roles" }
>>>      - { role: hadoop_jobtracker, when: "'HADOOP_JOBTRACKER' in
>>> ansible_local.host_roles.roles" }
>>>
>>>
>>> # roles/appserver/meta/main.yml
>>> ---
>>>   dependencies:
>>>     - { role: managed_interface, tags=initial }
>>>
>>> This is the simplified output of my setup. I have a server that is
>>> acting with a local run of a playbook, and gathers its roles, and then
>>> grabs the dependencies from its role to call the manage_interface role when
>>> its tagged as initial.
>>>
>>> # command line
>>> ansible-playbook site.yml --tags "initial"
>>>
>>> The command runs only its tasks/main.yml and not the dependencies.
>>>
>>> When I tried applying at the site.yml level things got really weird. It
>>> runs both the appserver and hadoop_jobtracker roles, seemingiy ignoring the
>>> "when" statements.
>>>
>>>    roles:
>>>      - { role: appserver,               tags: ['initial'], when:
>>> "'APPSERVERS' in ansible_local.host_roles.roles" }
>>>      - { role: hadoop_jobtracker, tags: ['initial'], when:
>>> "'HADOOP_JOBTRACKER' in ansible_local.host_roles.roles" }
>>>
>>> Are there some rules in which these can be applied properly, or am I
>>> hacking at the system and making trouble again?
>>>
>>> --
>>> 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/dac2a7a2-a8d7-40b8-b00d-
>>> 2801ff9289a2%40googlegroups.com
>>> <https://groups.google.com/d/msgid/ansible-project/dac2a7a2-a8d7-40b8-b00d-2801ff9289a2%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 ansible-project+unsubscr...@googlegroups.com.
> To post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/5e108fbe-0775-4b6f-86d0-b171c05660f1%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/5e108fbe-0775-4b6f-86d0-b171c05660f1%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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CA%2BnsWgxROW2zhZ2jqLr_BCdn%2B8%3D71W8KC9AGMhbZVNvh3QXWHw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to