0

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.

  • what should be the output after running `template` module with jinja2 template? also what is your input? – JBone Jun 30 '21 at 15:52
  • I've added the required output and input above, for clarity. – tony ramsey Jun 30 '21 at 19:06
  • What does your playbook look like so far? – larsks Jul 01 '21 at 02:52
  • Read up on Jinja templates and how the variables should be structured. I also had an issue with Ansible folder structure which I've fixed. I'm able to run the playbook properly now. Thanks for responses. – tony ramsey Jul 02 '21 at 02:37

0 Answers0