Cool. Just what I needed. Thanks Sumit!

On Tuesday, October 13, 2020 at 11:59:59 PM UTC-7 sjai...@redhat.com wrote:

> Hi Lou,
>
> You should be able to resolve the respective use case using Ansible loop 
> param(
> https://docs.ansible.com/ansible/latest/user_guide/playbooks_loops.html).
>
> Plz ref: 
> https://docs.ansible.com/ansible/latest/user_guide/playbooks_loops.html#with-sequence
>  as 
> it talks about how you can imitate range functionality.
>
>
> *Regards,*
> Sumit Jaiswal (he/him)
> Github/IRC: *justjais*
>
>
> On 14-Oct-2020, at 12:25 PM, lou <luna...@gmail.com> wrote:
>
> Hi Ansible experts,
>
> Is there a way to simplify writing the following (vlan):
>
> ---
> - hosts: X
>   connection: network_cli
>   remote_user: admin
>   become: yes
>   become_method: enable
>   vars:
>     ansible_network_os: "eos"
>   tasks:
>     - eos_vlan:
>         state: active
>         aggregate:
>           - { vlan_id: 1, name: default }
>           - { vlan_id: 2, name: Vl2 }
>           - { vlan_id: 3, state: suspend }
>           - { vlan_id: 4 }
>           - { vlan_id: 5 }
>           - { vlan_id: 6 }
>           - { vlan_id: 7 }
>           - { vlan_id: 8 }
>           - { vlan_id: 9 }
>           - { vlan_id: 10 }
>           - { vlan_id: 11 }
>           - { vlan_id: 12 }
>           - { vlan_id: 13 }
>           - { vlan_id: 14 }
> ...
> ...
> If I have to define thousands of vlan_ids, I would love to see Ansible 
> provide some ways to write a range. I'm going to configure thousands of IP 
> addresses, too. 
> I can generate the yaml file using python, but it'd be nice to just kind 
> of incorporate some sort of 'range' function . 
> I thought Jinja can do this, but I couldn't find any examples - or perhaps 
> Jinja is meant to read not to create data for Ansible. 
>
> https://yaml.org/YAML_for_ruby.html#ranges 
> Ruby has a way to provide range in yaml.  
>
> Any inputs are greatly appreciated. 
>
> Thanks,
> Lou
>
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Ansible Development" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to ansible-deve...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-devel/eaa8d343-fb1b-4b94-a06e-56cf815b942cn%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/ansible-devel/eaa8d343-fb1b-4b94-a06e-56cf815b942cn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-devel/228ce166-6462-40a5-87ac-5f3fa59e2531n%40googlegroups.com.

Reply via email to