Project

General

Profile

Actions

Feature #13847

open

Auto-provisioning custom scripts for NIC configurations

Added by Lukas Zapletal about 8 years ago. Updated about 7 years ago.

Status:
New
Priority:
High
Category:
Discovery plugin
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

Auto-provisioning rules are currently only associated with hostgroups, but these do not define NIC configurations. When user want to create a bond or change interface configuration (e.g. move to different subnet or/and boot mode), this is currently not possible.

Current idea is to provide a piece of script (ERB) that is executed during auto-provisioning and allows complex setups. We could reuse our template rendering and safe_mode code in order to associate a "template" that does something with the host. Something like:

<%
provision = @host.interfaces.provision.first
slave1 = @host.interfaces.where(:provision => false).first
slave2 = @host.interfaces.where(:provision => false).second
@host.interfaces.create_bond(slave1, slave2)
@host.name = "my_very_own_name_" + rand(12345)
@host.subnet = Subnet.find("192.168.77.0") if provision.mac ~= /^99:/
@host.save!
%>

Related issues 2 (2 open0 closed)

Related to Discovery - Refactor #13848: Refactor Discovery STI to FacetsNew02/23/2016Actions
Related to Discovery - Refactor #14035: Redesign discovered hostNew03/03/2016Actions
Actions #1

Updated by Lukas Zapletal about 8 years ago

Actions #2

Updated by Byron Miller about 8 years ago

I would love to see a network template that works with auto provisioning and/or single host provisioning.

Right now provisioning bonded servers means editing multiple interfaces, setting them to managed, creating a bond and if you use vlan tagging then creating a virtual interface on the bond and its error prone/cumbersome.

Would be nice to have a some kind of rules.. like "bond if active interface > 1" or if the discovery image could bond all active interfaces and create a host record with a default bond0.vlanid so all you have to do is change hostname/update ip

Actions #3

Updated by Lukas Zapletal about 8 years ago

Yeah, I was thinking instead of creating a copy of our New Host form to give users chance to provide a piece of code that is executed during auto-provisioning and allows complex setups. We could reuse our template rendering and safe_mode code in order to associate a "template" that does something with the host. Something like:

<%
provision = @host.interfaces.provision.first
slave1 = @host.interfaces.where(:provision => false).first
slave2 = @host.interfaces.where(:provision => false).second
@host.interfaces.create_bond(slave1, slave2)
@host.name = "my_very_own_name_" + rand(12345)
@host.subnet = Subnet.find("192.168.77.0") if provision.mac ~= /^99:/
@host.save!
%>
Actions #4

Updated by Lukas Zapletal about 8 years ago

For the record, there is a new effort emerging to replace our simple shell-based network provisioning template with more complex JSON-based configurator: https://github.com/ares/foreman_net_templates

Maybe if there is a possibility to freely associate this new kind of template with arbitrary hosts/hostgroups, then it can solve the problem (if we add required helper methods and variables to the safe_mode).

Actions #5

Updated by Lukas Zapletal about 8 years ago

The JSON idea is not relevant, scratch my previous comment. But what I described above is still valid.

Actions #6

Updated by Lukas Zapletal about 8 years ago

Actions #7

Updated by Lukas Zapletal over 7 years ago

  • Subject changed from Support NIC configurations in auto-provisioning to Auto-provisioning custom scripts for NIC configurations
  • Description updated (diff)
Actions #8

Updated by Lukas Zapletal over 7 years ago

  • Bugzilla link set to 1359034
Actions #9

Updated by Lukas Zapletal over 7 years ago

  • Assignee set to Lukas Zapletal
  • Priority changed from Normal to High
Actions #10

Updated by Lukas Zapletal about 7 years ago

WORKAROUND: It was found found that the best way is to just write a script to do the bonding as part of provisioning.

Actions

Also available in: Atom PDF