Re: [ansible-project] Passing a list on the command line

2015-03-30 Thread James Cammarata
That error occurs because roles were not really designed to be included dynamically like that, so the value is not run through the template engine. This is similar to the problem of using includes + with_* loops in v1, where the variables could come from an inventory source, which would lead to err

Re: [ansible-project] Passing a list on the command line

2015-03-30 Thread O. T. Suarez
Hi Rob, On Sun, Mar 29, 2015 at 8:33 PM, Rob White wrote: > Hmmm, this doesn't seem to work for the roles parameter. > > I tried the following command: > > ansible-playbook test.yml -i inventories/local -e > '{"roles_to_deploy":["role1","role2"]}' > > The test.yml playbook just had: > > tasks:

Re: [ansible-project] Passing a list on the command line

2015-03-29 Thread Rob White
Hmmm, this doesn't seem to work for the roles parameter. I tried the following command: ansible-playbook test.yml -i inventories/local -e '{"roles_to_deploy":["role1","role2"]}' The test.yml playbook just had: tasks: - name: Debug debug: msg="{{ item }}" with_items: "{{

Re: [ansible-project] Passing a list on the command line

2015-03-27 Thread O. T. Suarez
Hi Rob, Like James said, something like this should work: ansible-playbook my_playbook.yml -i local -e '{ "roles_to_deploy" : ['role1','role2']}' An alternative approach using tags: variables file: host_vars/ubuntu-trusty64-01 ~~~ --- roles: - collectd - nginx ~~~ playbook file: setup.yml

Re: [ansible-project] Passing a list on the command line

2015-03-27 Thread James Cammarata
Hi Rob, this is possible, you just need to format the extra variables as JSON, as documented here: http://docs.ansible.com/playbooks_variables.html#passing-variables-on-the-command-line James Cammarata Director, Ansible Core Engineering github: jimi-c On Thu, Mar 26, 2015 at 8:37 PM, Rob White w

[ansible-project] Passing a list on the command line

2015-03-26 Thread Rob White
Is it possible to pass a list as an extra-vars variable on the command line? I have tried various syntax but it doesn't work. E.g. ansible-playbook my_playbook.yml -i local --extra-vars roles_to_deploy=role1,role2 ansible-playbook my_playbook.yml -i local --extra-vars roles_to_deploy=[role1,ro