If that next_hops list is going to be more or less static for many
destinations, a simple option would be to define it once and then
reference it.
Note that I had to manually type this - please post real text next
time, instead of pixel images, so people can copy/paste it, and things
can get indexed by search engines for the benefit of other people
having the same problems.
---
- name: Cisco stuff
cisco.nxos.nxos_static_routes:
config:
- afi: ipv4
routes:
- dest: 192.168.2.0/24
next_hops: "{{ default_next_hops }}"
- dest: 192.168.4.0/24
next_hops: "{{ default_next_hops }}"
- dest: 192.168.6.0/24
next_hops: "{{ default_next_hops }}"
vars:
default_next_hops:
- interface: eth1/8
forward_router_address: 20.0.0.5
- interface: eth1/9
forward_router_address: 20.0.0.13
You can also construct the entire config variable by looping over it.
On Thu, 27 May 2021 at 09:37, Arnau Amargant Domene <[email protected]> wrote:
>
> Hello,
>
> Is there a way to have multiple destination address and the same next_hops?
> What I'm trying to do is shorten the lines of the playbook and better
> readability.
>
> If you see the following image repeats the same next_hops for different
> address:
>
>
>
> What i would like to achive is something like:
>
> - dest: 192.168.2.0/24, 192.168.4.0/24, 192.168.6.0/24
> next_hops:
> - interface: eth1/8
> forward_router_address: 20.0.0.5
> - interface: eth1/9
> forward_router_address: 20.0.0.13
>
> But i dont know if its possible.
> Thanks.
>
> --
> 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/d08ee0b3-4a2c-44c0-846b-7ab6cf8bd214n%40googlegroups.com.
--
Dick Visser
Trust & Identity Service Operations Manager
GÉANT
--
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/CAL8fbwM81ktZTaphR%3DVGkJW1Vv7eakNGMY-MDmrLj46NxSn7FA%40mail.gmail.com.