Looks to me like you're actually building a list of dicts, rather than a 
simple list. For example, this works for me:

---
- hosts: localhost
  vars:
    deploy:
        api:
          app:        v2.41.0
          develop:    v0.23.2
          tool:       v0.24.0
          consumers:  v0.16.0
          data:       v0.57.2
          bus:        eventbus-v1.1.2

  tasks:
    - include: tasks/update-api.yml
      when: "'api' in deploy.keys()"

-- or have I misunderstood what you're trying to do?

On Wednesday, 30 March 2016 06:01:42 UTC+1, [email protected] wrote:
>
> Thanks Jean
>
> But the issue is that even when I changed them to underscore (like below), 
> Im finding when I do the "'api' in deploy" it seems to not find it. Its 
> only when Its a completely match in a line it works. ie when: "'api_author' 
> in deploy". 
>
> Example (this does not work)
>
> deploy:
>       - api_assess
>       - api_author
>     
> - include: tasks/update-api.yml
>   when: "'api' in deploy"
>
> Example (this works)
>
> deploy:
>       - api_assess
>       - api_author
>     
> - include: tasks/update-api.yml
>   when: "'api_assess' in deploy"
>
> :/ 
>
> On Wednesday, 30 March 2016 15:14:25 UTC+11, Jean-Yves LENHOF wrote:
>>
>>
>>
>> Le 30/03/2016 04:48, [email protected] a écrit : 
>> > Hi All 
>> > 
>> > Doing something Im sure seems odd but building a production deployment 
>> > script based on some very manual steps. The dev team list out all the 
>> > services that need to be upgraded. I made a var called deploy to do 
>> > two things. 
>> > 1. Write out to a build file what needs to be build for prod. Its a 
>> > flat file 
>> > 2. Be able to include upgrade tasks based on if api or data appears in 
>> > the deployment list 
>> > 
>> > Example of my variable 
>> > 
>> > var: 
>> >   deploy: 
>> >       - api-app                     v2.41.0 
>> >       - api-develop              v0.23.2 
>> >       - api-tool                     v0.24.0 
>> >       - api-consumers         v0.16.0 
>> >       - api-data                    v0.57.2 
>> >       - api-bus                     eventbus-v1.1.2 
>>
>> Using minus or "." in a variable is very, very bad idea... Like in 
>> python those are functions 
>> Try using underscore instead 
>> So : 
>> api-app => api_app 
>> api-develop => api_develop 
>> ... 
>>
>>
>>
>> Regards, 
>>
>>

-- 
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/54022e0b-c727-40cb-be32-c66e4c0d5ba0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to