Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] Is it possible to deactive a interface? #46

Open
aanno2 opened this issue Nov 22, 2018 · 2 comments
Open

[Question] Is it possible to deactive a interface? #46

aanno2 opened this issue Nov 22, 2018 · 2 comments

Comments

@aanno2
Copy link

aanno2 commented Nov 22, 2018

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.

- role: MichaelRigart.interfaces
  interfaces_bridge_interfaces:
    - device: br0
      type: bridge
      bootproto: static
      address: x.x.x.x
      ports: [eth0]
      [...]

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:

- role: MichaelRigart.interfaces
  interfaces_ether_interfaces:
    - device: eth0
      bootproto: static
      address: x.x.x.x
      [...]
  interfaces_bridge_interfaces:
    - device: br0
      type: bridge
      bootproto: static
      ports: []
      [...]

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.

@markgoddard
Copy link

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?

@aanno2
Copy link
Author

aanno2 commented Nov 22, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants