How set static route in RHEL 8 with Ansible?

Viewed 2864

I have a requirement to maintain a list of static routes across many RHEL 8 VMs (~100) and thinking of managing this with Ansible.

Tried several methods suggested for different scenarios and still no luck.

Some options I tried were,

  1. net_static_route - Which is obviously for network appliances
  2. linux-system-roles.network (Redhat Doc)

In my case, I dont want to disturb any network interface which are actively being used.

Just want to add a static route to send the traffic via a different interface, not through default route.

Command I use to do this manually is like,

#sudo ip route add 192.168.1.2 via 192.168.100.1 dev ens224 proto static metric 100

Anyone has done something like this?

1 Answers
Related