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

Allow interfaces to be configured it ways other than with DHCP. #74

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Infiniverse
Copy link
Contributor

It seems likely that others will want to apply explicit configuration to interfaces, other than just DHCP. This patch allow that by defining a host variable that allow arbitrary interface configuration:

e.g:

ploy_jail_host_interface_config:
    - interface: em0
      config: inet 192.168.1.2/24
    - interface: vlan1
      config: inet 192.168.10.250/24 vlan 20 vlandev em0

@Infiniverse
Copy link
Contributor Author

Hmm, this defers interface setup until configuration file, whereas perhaps it needs to be done earlier at boot strap time.

@fschulze
Copy link
Member

The interfaces are already configurable during bootstrap via rc.conf: https://github.com/ployground/bsdploy/blob/master/bsdploy/bootstrap-files/rc.conf
Just overwrite that template in your bootstrap-files directory.

@Infiniverse
Copy link
Contributor Author

Is that parametrisable per host? How would I override it differently for different hosts?

I'm currently using this patch, with:

host_vars/host: 
  ---
  ploy_jail_host_cloned_interfaces: lo1 vlan10 vlan20
  ploy_jail_host_interface_config:
    - interface: em0
      config: up
    - interface: vlan10
      config: inet 10.10.26.218/28 vlan 10 vlandev em0
    - interface: vlan20
      config: inet 192.168.10.250/24 vlan 20 vlandev em0

host_vars/cpe:
  ---
  ploy_jail_host_cloned_interfaces: lo1 vlan20
  ploy_jail_host_interface_config:
    - interface: em0
      config: up
    - interface: vlan20
      config: DHCP vlan 20 vlandev em0

@fschulze
Copy link
Member

Just set the bootstrap-files option in ploy.conf for each host.

I kinda wonder why we don't do it per host automatically yet, I know I discussed it at some point with @tomster

@Infiniverse
Copy link
Contributor Author

What worries me about this approach, is that I've got to fork the rc.conf template per host, which means taking responsibility for the reset of the contents in that template. I'd rather not do that, as it's just the interfaces that I want specific configuration for. Can we split those out?

@Infiniverse
Copy link
Contributor Author

And, I guess that that means the clone interfaces fix that was merged the other day is now incorrect, as it creates the interfaces too late for the bootstrap to be applied. (That is applied at configuration time, not at bootstrap time).

@Infiniverse Infiniverse reopened this Apr 20, 2015
@fschulze
Copy link
Member

No, the cloned_interfaces is correct. Bootstrapping is only meant to get going at all. On EC2 for example we use the plain existing AMIs and only configure them. The rc.conf should be pretty stable for bootstrapping. All further customizations are done via ansible during the configure run.

@Infiniverse
Copy link
Contributor Author

Ah, so this interface patch is correct then, because it is used to configure cloned interfaces after boot. But, perhaps you're saying that it's not relevant to bsdploy and should be pulled into my local build?

@tomster
Copy link
Contributor

tomster commented Apr 20, 2015

yes and no :) currently, we do this in our projects, too i.e. creating custom rc.confs per host.

but just like yourself, i too would want to configure the network interfaces without maintaining multiple monolithic instances of rc.conf

maybe all that is needed here is to include a custom snippet per host.

the default definition of that snippet could be the current interface settings, namely to configure all interfaces via DHCP. if that's not what you want for a particular host you would define it in ploy.conf with whatever you need.

something along those lines...

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

Successfully merging this pull request may close these issues.

3 participants