LoginSignup
24

More than 5 years have passed since last update.

Ansibleでタグを使ってみる

Last updated at Posted at 2014-11-18

タグのつけ方

includeの際につける

- include: prod.yml tags=prod
- include: stg.yml tags=stg

rolesの際につける

- hosts: ws
  sudo: yes
  roles:
    - role: nginx
      tags: nginx
    - role: php
      tags: php
    - role: deploy
      tags: deploy

使い方

指定したタグのついたタスクのみ実行

$ ansible-playbook example.yml --tags "configuration,packages"

指定のタグのついたタスクをスキップして実行

$ ansible-playbook example.yml --skip-tags "notification"

参考

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
24