Open aanno2 opened 5 years ago
I'm afraid I haven't tried this. Which OS are you using? Can you check the interface configuration that is generated, and try to see what is wrong?
In fact it is working (i.e. it will give the ethernet (card) the ip addr) but it will (also) fail in the 'Check active bridge interface state' handler.
I'm using that on SLES 12 SP3 (I adapted the RedHat part a bit for Suse), but I guess there will be the same problem on RedHat and Debian.
The problem is that with the 'interfaces_bridge_interfaces' part, the bridge has no ip and no slaves afterwards, and without the 'interfaces_bridge_interfaces' part, the ip addr will not be assigned to the ethernet (card) directly because eth0 is still enslaved.
I've got the following:
1. I want to setup a bridge with a ethernet (card) enslaved
This is no problem with ansible-role-interfaces, even if the ethernet had the ip addr given to the bridge before the change. Easy peasy.
2. I want to go back: deactivate the bridge and assign the ip addr (direct) to the ethernet (card) again
This is possible with ansible-role-interfaces:
The
ports: []
is important to remove eth0 from being enslaved. However, this always errors out at the very end with the message:'Interface br0 is not active'
Well, I guess the bridge has no ip addr (any more), and nothing enslaved, hence
ifup
is not possible. A possible solution to this is to allow something like remove or 'deactive' as an possible explicit state for an interface.