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:
"{{ roles_to_deploy }}"
All good.
I then tried the same command with my original playbook which has:
roles:
"{{ roles_to_deploy }}"
I get an error "ERROR: value of 'roles:' must be a list"
On Friday, 27 March 2015 23:48:28 UTC+11, James Cammarata wrote:
>
> 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 <[email protected]
> <javascript:>> wrote:
>
>> 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,role2]
>> ansible-playbook my_playbook.yml -i local --extra-vars
>> roles_to_deploy=['role1','role2']
>>
>>
>> --
>> 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] <javascript:>.
>> To post to this group, send email to [email protected]
>> <javascript:>.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/a1c3c3ee-f51e-42c1-99bf-677ef6eaa8e5%40googlegroups.com
>>
>> <https://groups.google.com/d/msgid/ansible-project/a1c3c3ee-f51e-42c1-99bf-677ef6eaa8e5%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
--
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].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/1f360bb2-fd52-4a23-b96a-ebe3c51047bf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.