mirror of https://github.com/ansible/ansible.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
56 lines
1.3 KiB
ReStructuredText
56 lines
1.3 KiB
ReStructuredText
12 years ago
|
Tags
|
||
11 years ago
|
====
|
||
12 years ago
|
|
||
11 years ago
|
.. contents::
|
||
|
:depth: 2
|
||
|
|
||
11 years ago
|
If you have a large playbook it may become useful to be able to run a
|
||
11 years ago
|
specific part of the configuration without running the whole playbook.
|
||
|
|
||
|
Both plays and tasks support a "tags:" attribute for this reason.
|
||
12 years ago
|
|
||
|
Example::
|
||
|
|
||
|
tasks:
|
||
|
|
||
11 years ago
|
- yum: name={{ item }} state=installed
|
||
12 years ago
|
with_items:
|
||
|
- httpd
|
||
|
- memcached
|
||
|
tags:
|
||
|
- packages
|
||
|
|
||
11 years ago
|
- template: src=templates/src.j2 dest=/etc/foo.conf
|
||
12 years ago
|
tags:
|
||
|
- configuration
|
||
|
|
||
|
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"
|
||
|
|
||
11 years ago
|
You may also apply takes to roles::
|
||
12 years ago
|
|
||
11 years ago
|
roles:
|
||
|
- { role: webserver, port: 5000, tags: [ 'web', 'foo' ] }
|
||
12 years ago
|
|
||
11 years ago
|
And you may also tag basic include statements::
|
||
12 years ago
|
|
||
11 years ago
|
- include: foo.yml tags=web,foo
|
||
12 years ago
|
|
||
11 years ago
|
Both of these have the function of tagging every single task inside the include statement.
|
||
12 years ago
|
|
||
11 years ago
|
.. seealso::
|
||
|
|
||
|
:doc:`playbooks`
|
||
|
An introduction to playbooks
|
||
|
:doc:`playbooks_roles`
|
||
|
Playbook organization by roles
|
||
|
`User Mailing List <http://groups.google.com/group/ansible-devel>`_
|
||
|
Have a question? Stop by the google group!
|
||
|
`irc.freenode.net <http://irc.freenode.net>`_
|
||
|
#ansible IRC chat channel
|
||
|
|
||
|
|
||
|
|
||
12 years ago
|
|