install-required-roles.yml
- name: Install required roles
gather_facts: false
hosts: all
vars:
roles:
- role_file: "./requirements.yml"
roles_path: "./roles-must-be-installed/"
- role_file: "./requirements-x.yml"
roles_path: "./roles-must-be-installed-x/"
- role_file: "./requirements-x.yml"
roles_path: "./roles-must-be-installed-xx/"
tasks:
- name: Ensure multiple roles be installed according to 'Role Requirements Files'
local_action: command ansible-galaxy install --force --role-file {{ item.role_file }} --roles-path {{ item.roles_path }}
run_once: true
with_items: roles
# ansible-playbook -i a,b,c,d,e install-required-roles.yml
感想
勢いで書いてみただけ