Don’t use “roles:” but “tasks:” and use the include_role module. For example:

---
# roles/myrole/tasks/main.yml
- debug: var=bla
 
---
# playbook
- hosts: localhost
  connection: local
  gather_facts: no
  tasks:
   - name: Loop over role
     include_role:
      name: myrole
     vars:
      bla: "{{ item }}"
     with_items:
      - hello world
      - hi

I work as a freelancer, so if you don’t want to do that kind of things yourself or don’t have the time, just drop me a line to hire me.

Leave a Reply

Your email address will not be published. Required fields are marked *