LoginSignup
1
2

More than 5 years have passed since last update.

role enable/disable 切り替え

Posted at

条件によって,roleを利用するかどうか分岐する.

host_vars/hoge

role_enabled: "yes"

playbook

    - name: build role
      include_role:
        name: foo
      when:
        - foo_enabled == 'yes'
        - ansible_distribution == 'CentOS'
        - ansible_distribution_major_version == '7'

ところで,whenについている条件は and で繋がる.

1
2
0

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
1
2