Skip to content

Instantly share code, notes, and snippets.

@gswallow
Last active July 22, 2020 00:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save gswallow/9d1f8d4f8b6bb817a2fe3150f7e13342 to your computer and use it in GitHub Desktop.
Save gswallow/9d1f8d4f8b6bb817a2fe3150f7e13342 to your computer and use it in GitHub Desktop.
Ansible tags are a code smell
---
- hosts: localhost
vars:
ansible_connection: local
tasks:
- name: demo an untagged task
debug:
msg: I am an untagged task
- name: demo a normal tagged task
debug:
msg: I am a tagged task
tags:
- normal
- name: demo a never-tagged task
debug:
msg: I am a never-tagged task
tags:
- never
- run-never
- name: demo an always-tagged task
debug:
msg: I am an always-tagged task
tags:
- always
- exclude-always
@gswallow
Copy link
Author

gswallow commented May 6, 2019

Invocation Untagged Normal Never Always
ansible-playbook yes yes no yes
ansible-playbook --tags run-never no no yes yes
ansible-playbook --tags untagged yes no no yes
ansible-playbook --tags all yes yes no yes
ansible-playbook --tags untagged,run-never yes no yes yes
ansible-playbook --tags all,run-never yes yes yes yes
ansible-playbook --skip-tags always yes yes no no
ansible-playbook --tags all,run-never --skip-tags always yes yes yes no

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment