ruk·si

Ansible
Tags

Updated at 2017-03-21 23:46

For large playbooks, you might want to only execute parts of it. There is a special always tag that will always run a task, unless specifically skipped with -–skip-tags always.

# example.yml
tasks:
  - yum: name={{ item }} state=installed
    with_items:
      - httpd
      - memcached
    tags:
      - packages
  - template: src=templates/src.j2 dest=/etc/foo.conf
    tags:
      - configuration
ansible-playbook example.yml --tags "configuration,packages"
ansible-playbook example.yml --skip-tags "notification"

Sources