I want to access an array of tags defined at execution. Is this possible? For example:
ansible-playbook /dev/foo.yml --tags tag1
Can I read in some metadata containing value tag1 in foo.yml?
See Special Variables:
For example, the below play
shell> cat pb.yml
- hosts: all
tasks:
- debug:
msg: |
ansible_run_tags: {{ ansible_run_tags }}
ansible_skip_tags: {{ ansible_skip_tags }}
run_once: true
tags: [t1, t2, t8, t9]
gives (abridged)
shell> ansible-playbook --tags t1,t2 --skip-tags t3,t4 pb.yml
...
msg: |-
ansible_run_tags: ['t2', 't1']
ansible_skip_tags: ['t4', 't3']