Creating a playbook that installs a role - best practice

15 views
Skip to first unread message

Listing

unread,
Jul 2, 2017, 10:31:48 AM7/2/17
to Ansible Project
Hi guys,

I am looking for the best way to automatically install a role from a source. I am currently using these two ways:

1. via requirements.yml file
---
- src: geerlingguy.ruby

Then by running the following playbook (install.yml):

---
- hosts: all
  tasks:
  - name: run ansible galaxy
    local_action: command ansible-galaxy install -r requirements.yml

But this is of course also possible:

2. By with_items
---
- hosts: all
  tasks:
  - name: 
run ansible galaxy
    local_action: command ansible-galaxy install {{ item }}
    with_items:
    - geerlingguy.ruby

What do you guys think is the best way? They both work, but I am looking for the 'Red Hat' way. Can someone please shine some light for me on this?
Reply all
Reply to author
Forward
0 new messages