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?
No. It's not possible. Quoting from "Tags"
https://docs.ansible.com/ansible/latest/user_guide/playbooks_tags.html#tags
"You can see which tasks will be executed with --tags or --skip-tags by
combining it with --list-tasks:
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
* on the command line "--tags, --skip-tags"
* in configuration settings in tags section "run, skip"
* 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-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
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
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.
Thanks Vladimir