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

No ability to set accept_ra nor allow-hotplug #9

Open
chmduquesne opened this issue Feb 25, 2018 · 2 comments
Open

No ability to set accept_ra nor allow-hotplug #9

chmduquesne opened this issue Feb 25, 2018 · 2 comments

Comments

@chmduquesne
Copy link

Hi,

As far as I can see, this role does not let me set the option accept_ra. In the case of ipv6, it would be nice if it let me.

Also, you can only declare an interface as 'auto', but not as 'allow-hotplug'. For non pci interfaces this would be useful.

Cheers,
Christophe-Marie

@tersmitten
Copy link
Member

I think that you are right. Can you open a pull request?

@chmduquesne
Copy link
Author

I don't think I can make changes that are backward-compatible. The first problem, as far as I can see, is that currently network_interfaces_interfaces.{n}.auto is a boolean. Here I assume that you refer to auto as in the interface selection stanza, as in

auto eth0

or

allow-hotplug eth1

There is also another interface selection stanza, no-auto-down:

no-auto-down eth2

AFAIU, it can be combined with another selection stanza for the same interface, so you can have these 2 non exclusive stanzas:

allow-hotplug eth2
no-auto-down eth2

So really, this boolean should be dropped, and instead of having network_interfaces_interfaces.{n}.auto=True|False, we should have network_interfaces_interfaces.{n}.when, defaulting to [], which would describe the situations in which the system should have this interface up, and that would be a list of elements that are are auto|allow-*|no-auto-down rather than a key. This is further confusing, because 'auto' can also be used as a method to bring an inet6 interface up:

auto eth0
iface eth0 inet6 auto
    dhcp 1
    accept_ra 2

Also, lots of other options keywords have been left out: accept_ra is one, but then there is privext, dhcp (as an option, not as a method to bring the interface up as in iface eth0 inet6 dhcp), request_prefix, ll-attempts, ll-interval, hwaddress... To name only a few out of the many many possibilities. I invite you to read https://manpages.debian.org/stretch/ifupdown/interfaces.5.en.html for an exhaustive list.

Now I am a complete beginner with ansible (I have never written a role nor a template). But IIUC, instead of listing all the possibilities explicitly, it would maybe be more productive to simplify the template device.j2 to something like:

iface {{ item.device }} {{ item.family | default('inet', true) }} {{ item.method | default('dhcp', true) }}
{% for key in item.keys() %}
{%   if key not in ['bridge', 'subnet', 'pre-up', 'up', 'down', 'post-down'] %}
  {{ key }} {{ item[key] }}
{%   endif %}
{% endfor %}

I am ok to write a PR, but since this is potentially a lot of work for me, I want to make sure that you would be ok with my changes before I invest the time and energy.

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