PageRenderTime 15ms CodeModel.GetById 10ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/docsite/rst/playbooks_tags.rst

https://github.com/ajanthanm/ansible
ReStructuredText | 56 lines | 35 code | 21 blank | 0 comment | 0 complexity | 1c3cb1f83e4ee3d03cb21abc53a62104 MD5 | raw file
 1Tags
 2====
 3
 4If you have a large playbook it may become useful to be able to run a 
 5specific part of the configuration without running the whole playbook.  
 6
 7Both plays and tasks support a "tags:" attribute for this reason.
 8
 9Example::
10
11    tasks:
12
13        - yum: name={{ item }} state=installed
14          with_items:
15             - httpd
16             - memcached
17          tags:
18             - packages
19
20        - template: src=templates/src.j2 dest=/etc/foo.conf
21          tags:
22             - configuration
23
24If you wanted to just run the "configuration" and "packages" part of a very long playbook, you could do this::
25
26    ansible-playbook example.yml --tags "configuration,packages"
27    
28On the other hand, if you want to run a playbook *without* certain tasks, you could do this::
29
30    ansible-playbook example.yml --skip-tags "notification"
31
32You may also apply tags to roles::
33
34    roles:
35      - { role: webserver, port: 5000, tags: [ 'web', 'foo' ] }
36
37And you may also tag basic include statements::
38
39    - include: foo.yml tags=web,foo
40
41Both of these have the function of tagging every single task inside the include statement.
42
43.. seealso::
44
45   :doc:`playbooks`
46       An introduction to playbooks
47   :doc:`playbooks_roles`
48       Playbook organization by roles
49   `User Mailing List <http://groups.google.com/group/ansible-devel>`_
50       Have a question?  Stop by the google group!
51   `irc.freenode.net <http://irc.freenode.net>`_
52       #ansible IRC chat channel
53
54
55
56