Right now I'm guessing role names aren't being templated against extra vars
I agree the final one should work with your JSON example, and the first one should work if JMODULES was the name of a single role. I would file a bug in github to track this.... though this is the first time I've got the request. I would generally recommend structuring playbooks to record the desired system configuration, so passing things in and not having them in source control (what hosts get what roles) seems like a bit of an anti-pattern, hence why this is not implemented... but yes, I agree this in principle would be something you might expect to work (however unusual and unexpected). On Fri, Dec 20, 2013 at 9:30 AM, Nicolas Rodriguez <[email protected]>wrote: > Hi! > > I try to do dynamic role calling in playbook like that : > > --- > - hosts: "{{ HOST }}" > user: root > > roles: > - "{{ JMODULES }}" > > > command : ansible-playbook test.yml --extra-vars > '{"JMODULES":["apache","haproxy"]}' > > I get an error : AttributeError: 'list' object has no attribute > 'startswith' > > > If I change to > > --- > - hosts: "{{ HOST }}" > user: root > > roles: "{{ JMODULES }}" > > I get : ERROR: value of 'roles:' must be a list > > > Any help? > Thank you! > > -- > You received this message because you are subscribed to the Google Groups > "Ansible Project" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > -- Michael DeHaan <[email protected]> CTO, AnsibleWorks, Inc. http://www.ansibleworks.com/ -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
