Tenatively, yes, I don't see a problem with it applying to all the tasks/roles if done simply enough.
However given the ongoing v2 refactoring we should probably wait until this is complete. This should be in 1.9 (current release) timeframe. On Mon, Dec 15, 2014 at 9:06 AM, Adam Guthrie <[email protected]> wrote: > > Yeah, I guess I misunderstood the docs ( > http://docs.ansible.com/playbooks_tags.html) here. > > Would you be open to a pull request to implement this? > > Adam > > On Monday, 15 December 2014 13:24:51 UTC, Michael DeHaan wrote: >> >> Hi Adam, >> >> This looks like it's because you can add tags when pulling in roles, as >> well as tasks, but you can't tag a playbook on an include. >> >> It's something that sounds reasonable, but probably not something that >> has been done before. >> >> Try this: >> >> - hosts: all >> tasks: >> - include: my_tasks.yml tags=foo >> >> Etc >> >> And should be good to go. >> >> Alternatively: >> >> roles: >> - { name: foo, tags: [ 'foo', 'bar' ] } >> >> etc >> >> >> >> On Mon, Dec 15, 2014 at 7:07 AM, Adam Guthrie <[email protected]> wrote: >>> >>> I'm trying to add tags to tasks via includes but it doesn't work as I >>> expect. I have >>> >>> $ cat site.yml >>> #- { include: foo.yml, tags: [ foo ] } >>> - include: foo.yml tags=foo >>> >>> $ cat foo.yml >>> - hosts: all >>> tasks: >>> - name: foo >>> debug: msg=foo >>> >>> Then >>> >>> $ ansible-playbook -i inventory site.yml -t foo >>> ERROR: tag(s) not found in playbook: foo. possible values: >>> >>> Same error with 1.8.2 and current devel branch and with the other >>> include syntax commented above. >>> >>> Any help much appreciated, >>> >>> Adam >>> >>> -- >>> 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/066af8dd-6b55-4def-b458- >>> 7007a686e941%40googlegroups.com >>> <https://groups.google.com/d/msgid/ansible-project/066af8dd-6b55-4def-b458-7007a686e941%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/40f4f070-c3d7-4e92-952d-793f0421330c%40googlegroups.com > <https://groups.google.com/d/msgid/ansible-project/40f4f070-c3d7-4e92-952d-793f0421330c%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%2BnsWgwcoHTEwo3Tkang6%2BpVKspfRpgxWYrBG2SSU9MTa%3DfPyw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
