Ansible Tags
• If you have a large playbook it may become useful to be able to run a specific part of the configuration without running the whole playbook
• Both plays and tasks support a “tags:” attribute for this reason
• You can ONLY filter tasks based on tags from the command line with --tags or --skip-tags
• Adding “tags:” in any part of a play (including roles) adds those tags to the contained tasks
• If you wanted to just run the “configuration” and “packages” part of a very long playbook, you could do this: ansible-playbook example.yml --tags "configuration,packages“
• On the other hand, if you want to run a playbook without certain tasks, you could do this: ansible-playbook example.yml --skip-tags "notification"
Comments
Post a Comment