Hello all, is there a way to know during playbook execution which tags it was called with in command line with -t ?
I mean given ansible-playbook -t x,y,z how do I know inside the playbook I am only executing tasks with those tags?
Thanks
Hello all, is there a way to know during playbook execution which tags it was called with in command line with -t ?
I mean given ansible-playbook -t x,y,z how do I know inside the playbook I am only executing tasks with those tags?
Thanks
either there’s a tag: name in the playbook or in the tasks.
ansible_run_tags
great! thanks a lot!
tags: [‘always’]
is not giving me anything.
are you sure Brian?
thanks for the help.
it reflects tags used at runtime, not those defined on the task.
hummm, that’s it:
I tried:
and I run:
ansible-playbook -t delete pb.yml
and I get:
TASK [debug] *************************************************************************************************************
ok: [localhost] => {
“ansible_run_tags”: “VARIABLE IS NOT DEFINED!”
}
wrong?
thanks.
hummm, that's it:
I tried:
- debug: var=ansible_run_tags
tags: ['delete']
Indentation of tags if off, you should add two spaces.
and I run:
ansible-playbook -t delete pb.yml
and I get:
TASK [debug]
*************************************************************************************************************
ok: [localhost] => {
"ansible_run_tags": "VARIABLE IS NOT DEFINED!"
}wrong?
It work an Ansible 2.6.3
Identation was a e-mail body problem.
I think it should be my version. I will try to update it.
Thanks a lot.
Kai, thanks, it was my version 2.4.2, updated to 2.6.3.
Working now.
Thanks a lot to all.
ansible_run_tags was added in 2.5.