I'm trying to accomplish something similar, where I'd have a list of roles defined in the
group_vars/all file (where I'd disable certain roles by just commenting them out):
---
install_roles:
- apache
#- nginx
- php
- mysql
#- mariadb
- varnish
And then use that list variable in the provision.yml file:
---
- hosts: local
gather_facts: yes
roles: install_roles # first try
roles: "{{ install_roles }}" # second try
roles: { with_items: install_roles } # third try
However, all the variations above fail with "ERROR: value of 'roles:' must be a list", so I'm guessing using a list var for roles is not supported?