On 10/30/20 12:24 PM, Pravin V wrote: > Hello Everyone, > > I have a playbook > - name: Test > uri: > url: https://192.168.1.1 > method: POST > body: > "IPADDRESS={{ item.address }}" > body_format: "form-urlencoded" > when: item.device_type.model == "2921" or > item.device_type.model == "3931" > > But this way list is going very big. > Now I want to create some sort of dictionary and put the name of that to use > with when like below: > vars: > - ciscorouters: > - 2921 > - 3931 > > when: item.device_type.model == {{ ciscorouters }} > > Please let me know the procedure.
1. You can't use {{ }} in when conditions. The condition is already virtually
wrapped in {{ }}
2. Try the following:
when: item.device_type.model in ciscorouters
Regards
Racke
>
> Thanks in advance.
>
> --
> 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]
> <mailto:[email protected]>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/ff66b4cc-0963-4ca3-a251-6c0e5a2c12c3n%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/ff66b4cc-0963-4ca3-a251-6c0e5a2c12c3n%40googlegroups.com?utm_medium=email&utm_source=footer>.
--
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration. Provisioning with Ansible.
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/268d0ace-06b0-82f3-73d5-447d2834bac7%40linuxia.de.
signature.asc
Description: OpenPGP digital signature
