Hi Rob,

On Sun, Mar 29, 2015 at 8:33 PM, Rob White <[email protected]> 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:
>     - 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 }}"
>
>
Couldn't find a way to make it work that way.
Here's an alternative:


  roles:
   - { role: role1, when 'role1' in roles_to_deploy}
   - { role: role2, when 'role2' in roles_to_deploy}

It might seems too much work to edit the playbook file each time you add a
new role, but it's just a single line and when comparing the number of
times you'll be executing that playbook file against the number of edits,
it should worth the shot.

Regards,
Osvaldo

-- 
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/CAJZu1hX8rwGkGTO1xK9%3D90P3DNuk-1SZB_65u6oPz4ow%3D-AzOA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to