3.2 Playbook Tags

Source: Internet
Author: User

If you have a big playbook and you just want to run one of those tasks, tags is your best choice. How to use it? first, the most common form of use:Take the official example: Tasks:-yum:name={{Item}} state=installed with_items:-httpd-memcached Tags:- PACKAGES-TEMPLATE:SRC=TEMPLATES/SRC.J2 dest=/etc/foo.conf Tags:-configuration At this point if you want to run only one of these tasks, this Run when you specify tags can ansible-playbook example.yml--tags "configuration,packages" #run more Tagsansible-playbook example.yml-- Tags packages # only run a tags instead, you can also skip a taskansible-playbook example.yml--skip-tags Configurat Ion two, tags and role combined useTags This property can also be applied to role, for example: roles:-{role:webserver, port:5000, Tags: [' Web ', ' foo ']} third, tags and include the use of combined-Include:foo.yml Tags=web,foo This way, all the tasks defined in FOOL.YML are executed Iv. Special tags built into the systemAlways, tagged, untagged and all are four systems built-in tags, have their own special meaning forever: After specifying this tag, task tasks will never be executed without considering whether to use the--skip-tags tag tagged: when-- tags are specified as it, then whenever a task with tags tag is executed,--skip-tags effect is reversed untagged: When--tags is specified for it, all tasks without tag tags will be executed,--the Skip-tags effect opposite all: This tag does not need to be specified, which is the ansible-playbook default execution. All tasks are executed



From for notes (Wiz)



3.2 Playbook Tags

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.