From fe95d71fbd0b916e538480b5df93fa93e0b23585 Mon Sep 17 00:00:00 2001 From: "William L. Thomson Jr" Date: Tue, 15 Nov 2016 17:16:04 -0500 Subject: [PATCH] docsite/rst/playbooks_tags.rst: Added section on tag reuse (#17729) * docsite/rst/playbooks_tags.rst: Added section on tag reuse * Update playbooks_tags.rst Minor grammatical clarification. --- docsite/rst/playbooks_tags.rst | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/docsite/rst/playbooks_tags.rst b/docsite/rst/playbooks_tags.rst index f6ab523cb6..76d1ec0fdf 100644 --- a/docsite/rst/playbooks_tags.rst +++ b/docsite/rst/playbooks_tags.rst @@ -30,6 +30,31 @@ On the other hand, if you want to run a playbook *without* certain tasks, you co ansible-playbook example.yml --skip-tags "notification" +.. _tag_reuse: + +Tag Resuse +``````````````` +You can apply the same tag name to more than one task, in the same file +or included files. This will run all tasks with that tag. + +Example:: + --- + # file: roles/common/tasks/main.yml + + - name: be sure ntp is installed + yum: name=ntp state=installed + tags: ntp + + - name: be sure ntp is configured + template: src=ntp.conf.j2 dest=/etc/ntp.conf + notify: + - restart ntpd + tags: ntp + + - name: be sure ntpd is running and enabled + service: name=ntpd state=started enabled=yes + tags: ntp + .. _tag_inheritance: Tag Inheritance