I've used Ansible for 'show' commands to validate configurations, but have not used it to configure. Want to use Ansible to configure 60+ routers with IP SLA and Track. Then tying the Track to a static ip route statement.
The IP SLA and Track configuration will be the same on all routers. So I can write it in the playbook and apply it to all. However, each router's ip route statement has a unique variable, as the next hop IP address is different on each router, such as:
RTR1:
ip route 0.0.0.0 0.0.0.0 x.x.x.x
RTR2:
ip route 0.0.0.0 0.0.0.0 y.y.y.y
My understanding is that the 'next hop' variable can be handled with Jinja2 in Ansible. I've never used it. Can someone please point me in the right direction in terms of using Jinja with above variables or if there's a better/alternate method. I'm running Ansible version 2.9.22, Ubuntu 18.0.4
The output of configuration on each router is shown below - which also reflects the exact configuration input.
track 8 ip sla 1 reachability
ip sla 1
icmp-echo 10.1.13.2 source-ip 10.0.12.1
ip sla schedule 1 life forever start-time now
ip route 0.0.0.0 0.0.0.0 x.x.x.x track 8
ip route 0.0.0.0 0.0.0.0 x.x.x.x 10
Please note that the 'x.x.x.x', which is the next hop variable will be different on each router.