docs: tags: streamline indentation (#50875)

* docs: tags: streamline indentation to minimal indent
This commit is contained in:
René Moser 2019-01-15 15:54:38 +01:00 committed by Alicia Cozine
parent df6d1aec56
commit d60d794411

View file

@ -15,20 +15,20 @@ below), but its simplest use is with individual tasks. Here is an example
that tags two tasks with different tags:: that tags two tasks with different tags::
tasks: tasks:
- yum: - yum:
name: "{{ item }}" name: "{{ item }}"
state: present state: present
loop: loop:
- httpd - httpd
- memcached - memcached
tags: tags:
- packages - packages
- template: - template:
src: templates/src.j2 src: templates/src.j2
dest: /etc/foo.conf dest: /etc/foo.conf
tags: tags:
- configuration - configuration
If you wanted to just run the "configuration" and "packages" part of a very long playbook, you can use the ``--tags`` option on the command line:: If you wanted to just run the "configuration" and "packages" part of a very long playbook, you can use the ``--tags`` option on the command line::
@ -63,7 +63,7 @@ This example tags several tasks with one tag, "ntp"::
src: ntp.conf.j2 src: ntp.conf.j2
dest: /etc/ntp.conf dest: /etc/ntp.conf
notify: notify:
- restart ntpd - restart ntpd
tags: ntp tags: ntp
- name: be sure ntpd is running and enabled - name: be sure ntpd is running and enabled
@ -93,12 +93,12 @@ tagged with 'bar', and the second has all its tasks tagged with 'foo'::
- hosts: all - hosts: all
tags: tags:
- bar - bar
tasks: tasks:
... ...
- hosts: all - hosts: all
tags: ['foo'] tags: [ foo ]
tasks: tasks:
... ...
@ -108,16 +108,16 @@ You may also apply tags to the tasks imported by ``roles``::
- role: webserver - role: webserver
vars: vars:
port: 5000 port: 5000
tags: [ 'web', 'foo' ] tags: [ web, foo ]
And to ``import_role:`` and ``import_tasks:`` statements:: And to ``import_role:`` and ``import_tasks:`` statements::
- import_role: - import_role:
name: myrole name: myrole
tags: [web,foo] tags: [ web, foo ]
- import_tasks: foo.yml - import_tasks: foo.yml
tags: [web,foo] tags: [ web, foo ]
All of these apply the specified tags to EACH task inside the play, imported All of these apply the specified tags to EACH task inside the play, imported
@ -161,12 +161,12 @@ Playbook file::
Role tasks file:: Role tasks file::
- block: - block:
- name: First task to run - name: First task to run
... ...
- name: Second task to run - name: Second task to run
... ...
tags: tags:
- mytag - mytag
.. _special_tags: .. _special_tags:
@ -179,16 +179,15 @@ There is a special ``always`` tag that will always run a task, unless specifical
Example:: Example::
tasks: tasks:
- debug:
msg: "Always runs"
tags:
- always
- debug: - debug:
msg: "Always runs" msg: "runs when you use tag1"
tags: tags:
- always - tag1
- debug:
msg: "runs when you use tag1"
tags:
- tag1
.. versionadded:: 2.5 .. versionadded:: 2.5
@ -197,8 +196,8 @@ Another special tag is ``never``, which will prevent a task from running unless
Example:: Example::
tasks: tasks:
- debug: msg='{{ showmevar}}' - debug: msg="{{ showmevar}}"
tags: [ 'never', 'debug' ] tags: [ never, debug ]
In this example, the task will only run when the ``debug`` or ``never`` tag is explicitly requested. In this example, the task will only run when the ``debug`` or ``never`` tag is explicitly requested.
@ -218,7 +217,3 @@ By default, Ansible runs as if ``--tags all`` had been specified.
Have a question? Stop by the google group! Have a question? Stop by the google group!
`irc.freenode.net <http://irc.freenode.net>`_ `irc.freenode.net <http://irc.freenode.net>`_
#ansible IRC chat channel #ansible IRC chat channel