Project

General

Profile

Download (2.07 KB) Statistics
| Branch: | Tag: | Revision:
<%#
name: kickstart_ifcfg_generic_interface
model: ProvisioningTemplate
snippet: true
model: ProvisioningTemplate
kind: snippet
-%>
BOOTPROTO="<%= @dhcp ? 'dhcp' : 'none' -%>"
<%- unless @dhcp || @subnet.nil? -%>
<%- if @interface.ip.present? -%>
<%= "IPADDR=\"#{@interface.ip}\"" %>
<%= "NETMASK=\"#{@subnet.mask}\"" %>
<%- if @subnet.gateway.present? -%>
<%= "GATEWAY=\"#{@subnet.gateway}\"" %>
<%- end -%>
<%- end -%>
<%- end -%>
<%- if @interface.ip6.present? -%>
<%= "IPV6INIT=yes" %>
<%= "IPV6_AUTOCONF=no" %>
<%= "IPV6ADDR=#{@interface.ip6}" %>
<%- if !@subnet6.nil? && @subnet6.gateway.present? -%>
<%= "IPV6_DEFAULTGW=#{@subnet6.gateway}" %><%= '%$real' if @subnet6.gateway.match(/^fe80:/) %>
<%- end -%>
<%= "IPV6_PEERDNS=no" %>
<%- end -%>
<%- if @interface.domain -%>
DOMAIN="<%= @interface.domain %>"
<%- end -%>
DEVICE=$real
<%- unless @interface.virtual? -%>
<%= "HWADDR=\"#{@interface.mac}\"" %>
<%- end -%>
ONBOOT=yes
<%- primary = @interface.primary ? 'yes' : 'no' -%>
PEERDNS=<%= primary %>
PEERROUTES=<%= primary %>
DEFROUTE=<%= primary %>
<%- if @interface.primary -%>
<%- if !@dhcp && @subnet && @subnet.dns_primary.present? -%>
<%= "DNS1=\"#{@subnet.dns_primary}\"" %>
<%- if @subnet.dns_secondary.present? -%>
<%= "DNS2=\"#{@subnet.dns_secondary}\"" %>
<%- end -%>
<%- end -%>
<%- end -%>
<%- if @interface.virtual? && (!@subnet.nil? && (@subnet.has_vlanid? || @interface.vlanid.present?)) -%>
<%= "VLAN=yes" %>
<%- if @attached_to_bond -%>
<%= "NM_CONTROLLED=no" %>
<%- end -%>
<%- if @interface.identifier.match(/^vlan\d+/) -%>
<%= "VLAN_NAME_TYPE=VLAN_PLUS_VID_NO_PAD" %>
<%= "PHYSDEV=#{@interface.attached_to}" %>
<%- if @bonding_interfaces.include?(@interface.attached_to) -%>
<%= "TYPE=bonding" %>
<%- end -%>
<%- end -%>
<%- elsif @interface.virtual? && !@subnet.nil? && !@subnet.has_vlanid? && @interface.identifier.include?(':') -%>
<%= "TYPE=Alias" %>
<%- end -%>
<%- if @subnet -%>
<%= "MTU=#{@subnet.mtu}" %>
<%- elsif @subnet6 -%>
<%= "MTU=#{@subnet6.mtu}" %>
<%- end -%>
(17-17/34)