Hi
Sorry if this has been covered but i am new to foreman.
What is the best practice for configuring NICs on a server. There appear
to be 2 ways - one in the kickstart template and one as a post finish
script/snippet I have a server with 4 eth devices to 4 separate networks
(no bonding)
At the moment, my primary interface is only configured within the main
kickstart template.
network --bootproto <%= "static --ip=#{@host.ip}
–netmask=#{@host.subnet.mask} --gateway=#{@host.subnet.gateway}
–nameserver=#{[@host.subnet.dns_primary,@host.subnet.dns_secondary].reject{|n|
n.blank?}.join(',')}" %> --hostname <%= @host %>
Option1:
I have seen a post where by each additional interface can be configured
with something like the below.
-How does this tie in with what you configure in the GUI when you are
creating a new host? I can set an IP and MAC address but the subnet is
greyed out and cannot be selected? Will Foreman cycle through each NIC i
configure and pair accordingly with the MAC i have specified?
-Does it automatically setup the ifcfg-ethX config file?
-What does managed actually mean?
<% if !@host.interfaces.managed.empty? -%>
<% @host.managed_interfaces.each do |interfaces| -%>
network --bootproto=static --ip=<%= interface.ip %> --netmask=<%=
interface.subnet.mask %> --device=<%= interface.identifier %> --noipv6
<% end -%>
<% end -%>
Option2:
Use the kickstart_networking_setup snippet
https://github.com/theforeman/community-templates/blob/master/snippets/kickstart_networking_setup.erb
cat << EOF > /etc/sysconfig/network-scripts/ifcfg-$real
BOOTPROTO="<%= dhcp ? 'dhcp' : 'none' -%>"
<% unless dhcp -%>
IPADDR="<%= interface.ip -%>"
NETMASK="<%= subnet.mask -%>"
<% if !subnet.gateway.nil? && !subnet.gateway.empty? -%>
GATEWAY="<%= subnet.gateway %>"
<% end -%>
<% end -%>
DEVICE="$real"
<% unless virtual -%>
HWADDR="<%= interface.mac -%>"
<% end -%>
ONBOOT=yes
<% if interface.respond_to?(:primary) && interface.primary -%>
PEERDNS=yes
PEERROUTES=yes
<% else -%>
PEERDNS=no
PEERROUTES=no
<% end -%>
<% if vlan -%>
VLAN=yes
<% elsif alias_type -%>
TYPE=Alias
<% end -%>
EOF
This appears to configure the primary interface as well.
I've yet to test this - what are/how are others doing it?
Cheers