# Can playbook tag input be placed in group\_var?

**URL:** <https://forum.ansible.com/t/can-playbook-tag-input-be-placed-in-group-var/33475>\
**Category:** Ansible Project\
**Created:** [July 23, 2020, 5:37pm UTC](https://forum.ansible.com/t/can-playbook-tag-input-be-placed-in-group-var/33475 "2020-07-23T17:37:38Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![chr00ted](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/chr00ted/32/2188_2.png) [@chr00ted](https://forum.ansible.com/u/chr00ted)\
**Post date:** [July 23, 2020, 5:37pm UTC](https://forum.ansible.com/t/can-playbook-tag-input-be-placed-in-group-var/33475/1 "2020-07-23T17:37:38Z")

</div>

If I’m running a playbook that has tags, can I place the tag information be placed in the group\_vars? That way if I run a playbook against against an ansible group with children, the children could have different tags for use in the playbook?

---

<div class="post-metadata">

**Author:** ![vbotka](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/vbotka/32/359_2.png) [@vbotka](https://forum.ansible.com/u/vbotka)\
**Post date:** [July 23, 2020, 7:34pm UTC](https://forum.ansible.com/t/can-playbook-tag-input-be-placed-in-group-var/33475/2 "2020-07-23T19:34:54Z")

</div>

No. It's not possible. Quoting from "Tags"  
[https://docs.ansible.com/ansible/latest/user\_guide/playbooks\_tags.html#tags](https://docs.ansible.com/ansible/latest/user_guide/playbooks_tags.html#tags)

&nbsp;&nbsp;"You can see which tasks will be executed with --tags or --skip-tags by  
&nbsp;&nbsp;combining it with --list-tasks:

&nbsp;&nbsp;ansible-playbook example.yml --tags "configuration,packages" --list-tasks

The tags are evaluated when a playbook starts. Otherwise the control flow  
could be changed on the fly by such variables. Tags can be set

&nbsp;&nbsp;\* on the command line "--tags, --skip-tags"  
&nbsp;&nbsp;\* in configuration settings in tags section "run, skip"  
&nbsp;&nbsp;\* in environment "ANSIBLE\_RUN\_TAGS, ANSIBLE\_SKIP\_TAGS"

See  
[https://docs.ansible.com/ansible/latest/reference\_appendices/config.html#tags-run](https://docs.ansible.com/ansible/latest/reference_appendices/config.html#tags-run)  
[https://docs.ansible.com/ansible/latest/reference\_appendices/config.html#tags-skip](https://docs.ansible.com/ansible/latest/reference_appendices/config.html#tags-skip)

Next option to consolidate tags is the concept of Ansible runner's project  
[https://ansible-runner.readthedocs.io/en/latest/intro.html#env-cmdline](https://ansible-runner.readthedocs.io/en/latest/intro.html#env-cmdline)

---

<div class="post-metadata">

**Author:** ![jean-yves](https://avatars.discourse-cdn.com/v4/letter/j/a587f6/32.png) [@jean-yves](https://forum.ansible.com/u/jean-yves)\
**Post date:** [July 23, 2020, 7:36pm UTC](https://forum.ansible.com/t/can-playbook-tag-input-be-placed-in-group-var/33475/3 "2020-07-23T19:36:08Z")

</div>

Hi,

I think you should be asking what you want to do more clearly (Perhaps with a little playbook to be completed) instead of trying some obscured things

Regards,

JYL

---

<div class="post-metadata">

**Author:** ![vbotka](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/vbotka/32/359_2.png) [@vbotka](https://forum.ansible.com/u/vbotka)\
**Post date:** [July 23, 2020, 7:57pm UTC](https://forum.ansible.com/t/can-playbook-tag-input-be-placed-in-group-var/33475/4 "2020-07-23T19:57:12Z")

</div>

It's not possible on the playbooks' level actually. Any attempt will look  
obscure.

Still the use-case is valid: "Set the tags for an inventory group". This can  
be done on top of a playbook. In a script, AWX, Ansible runner, etc.

---

<div class="post-metadata">

**Author:** ![chr00ted](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/chr00ted/32/2188_2.png) [@chr00ted](https://forum.ansible.com/u/chr00ted)\
**Post date:** [July 23, 2020, 8:57pm UTC](https://forum.ansible.com/t/can-playbook-tag-input-be-placed-in-group-var/33475/5 "2020-07-23T20:57:47Z")

</div>

Thanks Vladimir
