michaelrigart / ansible-role-interfaces

An ansible role for configuring different network interfaces
GNU General Public License v3.0
83 stars 61 forks source link

Allow routes to accept routes as strings #144

Closed Aethylred closed 1 year ago

Aethylred commented 1 year ago

This change gives routes the same behaviour as rules where they can be a mix of strings and hashes and allows setting of rules and routes that don't fit the expected formats. Examples used in the documentation were to configure the rules for a HAproxy setup as per Transparent Proxying and Binding with HAProxy

Aethylred commented 1 year ago

This was also easier to do that figure out how to get it to pass through local, locahost, default, and other strings that are valid for rules and routes. In it's current form the role only accepts IP addresses.

Aethylred commented 1 year ago

The example rules are not exactly perfect, they're roles for the lo device, but defined on the eth1 device, but the module doesn't really have a method for setting rules independently of devices. Adding a interfaces_extra_rules was more work than I had time for

Aethylred commented 1 year ago

I think I can follow up with the Debian and nmconnection templates, but it looks like they don't consistently have the string-or-mapping behaviour as described for rules, bond_Debian.j2 is missing it for example.

...and some look like they won't handle:

rules:
    - from: 10.10.10.1
      table: frontend
Aethylred commented 1 year ago

@markgoddard I've addressed the points you brought up, I've also got a few ideas that would improve consistency in the templates, but this will do for now.