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.
Ruby has a way to provide range in yaml.
Any inputs are greatly appreciated.
Thanks,
Lou