As noted in the example over at https://github.com/ansible/ansible/issues/9733 I'm setting the host-group when including the playbook like this:
- include: test-include.yml hosts="group" Am Samstag, 6. Dezember 2014 05:50:17 UTC+1 schrieb Michael DeHaan: > > Where did you define the 'my group' variable? > > > > On Fri, Dec 5, 2014 at 2:48 PM, Wolfgang Ziegler <[email protected] > <javascript:>> wrote: > >> Sure, I've been using {{ hosts }} - I just copied the example from the >> old docs - sry for that. I did some more testing and think this is a bug. I >> reported it with a simple example playbook at >> https://github.com/ansible/ansible/issues/9733 >> >> Am Freitag, 5. Dezember 2014 01:56:26 UTC+1 schrieb Michael DeHaan: >>> >>> Ansible hasn't used a dollar sign for variable replacement in a long time >>> >>> Try >>> >>> {{ hosts }} >>> >>> >>> >>> On Thu, Dec 4, 2014 at 2:10 AM, Wolfgang Ziegler // fago < >>> [email protected]> wrote: >>> >>>> I figured, the variabel replacement still works fine - but for some >>>> reason the host groups are not forwarded to the included playbook anymore. >>>> E.g., in root playbook the host is in group "mygroup", but when the >>>> included playbook runs for "mygroup" the host is not matched any more. The >>>> output is like this: >>>> >>>> PLAY ["mygroup"] ****************************** >>>> ******************************** >>>> skipping: no hosts matched >>>> >>>> 2014-12-04 10:40 GMT+01:00 Wolfgang Ziegler <[email protected]>: >>>> >>>>> Hi! >>>>> >>>>> I'm using the pattern outlined at https://github.com/ansible/ >>>>> ansible/pull/1956 to include playbooks for a limitted group of hosts. >>>>> In short: >>>>> >>>>> --- >>>>> # configure-webservers.yaml >>>>> - name: configure the webservers >>>>> hosts: webservers:&$hosts tasks: ... >>>>> >>>>> --- >>>>> # Configure staging server >>>>> - include: configure-webservers.yaml hosts=staging >>>>> >>>>> >>>>> >>>>> >>>>> However, this stopped working when upgrading to ansible 1.8.1. Is this >>>>> a bug, or is passing variables to playbook includes like that not >>>>> supported >>>>> any more? >>>>> >>>>> If it's not supported any more, any other suggestions on how to do >>>>> this? >>>>> >>>>> My use case is a rather general provising playbook - including >>>>> multiple roles and possibly some custom tasks - which I want to be able >>>>> to >>>>> dynamically apply to some hosts from a playbook run. It shouldn't apply >>>>> to >>>>> "all" hosts though. >>>>> >>>>> Best regards, >>>>> Wolfgang >>>>> >>>>> -- >>>>> You received this message because you are subscribed to a topic in the >>>>> Google Groups "Ansible Project" group. >>>>> To unsubscribe from this topic, visit https://groups.google.com/d/ >>>>> topic/ansible-project/c8bdwPtR640/unsubscribe. >>>>> To unsubscribe from this group and all its topics, 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/03e0501f-ade6-4a4d-ae3a- >>>>> 59cc9eba118c%40googlegroups.com >>>>> <https://groups.google.com/d/msgid/ansible-project/03e0501f-ade6-4a4d-ae3a-59cc9eba118c%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/CAL0uX3SK3kNtTAnaocPFQ7moBDUEh >>>> at6NbZ66w2Pr3_3SN9EBw%40mail.gmail.com >>>> <https://groups.google.com/d/msgid/ansible-project/CAL0uX3SK3kNtTAnaocPFQ7moBDUEhat6NbZ66w2Pr3_3SN9EBw%40mail.gmail.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] <javascript:>. >> To post to this group, send email to [email protected] >> <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/ansible-project/492b382f-7567-41ec-8e80-ac0c4d28cabc%40googlegroups.com >> >> <https://groups.google.com/d/msgid/ansible-project/492b382f-7567-41ec-8e80-ac0c4d28cabc%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/6f593126-9555-4f24-9a26-3e8040dc8ec1%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
