Tags
The tags provide a handy tool to run selected tasks of the role. The below command lists the available tags
1 shell> ansible-playbook pb.yml --list-tags
2
3 playbook: pb.yml
4
5 play #1 (srv.example.com): srv.example.com TAGS: []
6 TASK TAGS: [always, cl_debug, cl_files, cl_packages, cl_sanity,
7 cl_services, cl_setup, cl_states, cl_vars]
For example, using the tag cl_debug displays the variables and
their values when cl_debug=true. With this tag specified -t
cl_debug the tasks vars.yml will also run because of the tag
always
shell> ansible-playbook pb.yml -t cl_debug -e cl_debug=true
See what packages will be installed
shell> ansible-playbook pb.yml -t cl_packages --check
Install packages and exit the play
shell> ansible-playbook pb.yml -t cl_packages
See also
See Best practice on how to use tags efficiently
See main.yml annotated source code
Hint
Do not display skipped hosts. Set
ANSIBLE_DISPLAY_SKIPPED_HOSTS=falseshell> ANSIBLE_DISPLAY_SKIPPED_HOSTS=false ansible-playbook pb.yml -t cl_debug