LoginSignup
0
0

More than 5 years have passed since last update.

Ansible の roles の dependencies に Galaxy Roles は書かないほうが良さそう

Posted at

become は tasks か roles に対して個別に設定すべき」というプラクティスがあると思っているのですが(これは別の記事で書きたいと思ってる)。meta の dependencies に Galaxy Roles のものが書かれているものがあって、それは roles のなかで root 権限を要求されるタスクについても become: true がされていないことが多くて詰むので、やめましょうって話。

例えば geerlingguy.redispackage モジュールを使っているタスクbecome: true がないので、以下のような使い方をする必要がある。

# とある playbook で
- hosts: redis
  become: true
  roles:
    - role: geerlingguy.redis
# とある playbook で
- hosts: redis
  roles:
    - role: geerlingguy.redis
      become: true
# とある tasks で
- name: "Install Redis"
  become: true
  import_role:
    - name: geerlingguy.redis

しかし、meta ファイルで次のような書き方はできない

# とある meta で
- dependencies
  - role: geerlingguy.redis
    become: true # ← 無視される
0
0
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
0
0