summaryrefslogtreecommitdiffstats
path: root/deploy/adapters/cobbler/snippets/networking.xml
diff options
context:
space:
mode:
authorbaigk <baiguoku@huawei.com>2015-08-02 21:56:23 -0400
committerbaigk <baiguoku@huawei.com>2015-08-02 22:46:09 -0400
commit79b571dae951ba9bfe36440750c1a1408b19cd69 (patch)
treee930de3f7b9bb15f5a705fcc5b13011a500e91f4 /deploy/adapters/cobbler/snippets/networking.xml
parent9e4cf51b4b2815e90824859b52d649b6c37219d9 (diff)
support deployment os of ubuntu 14.04 with cobbler for compass
JIRA: COMPASS-3 Change-Id: I703658b04ec7ec1df4a2a3b9eac5656419d8fd9f Signed-off-by: baigk <baiguoku@huawei.com>
Diffstat (limited to 'deploy/adapters/cobbler/snippets/networking.xml')
-rw-r--r--deploy/adapters/cobbler/snippets/networking.xml131
1 files changed, 131 insertions, 0 deletions
diff --git a/deploy/adapters/cobbler/snippets/networking.xml b/deploy/adapters/cobbler/snippets/networking.xml
new file mode 100644
index 00000000..a468ab47
--- /dev/null
+++ b/deploy/adapters/cobbler/snippets/networking.xml
@@ -0,0 +1,131 @@
+#set $hostname = $getVar("hostname","")
+#if $hostname == ""
+#set $hostname = $getVar("system_name","cobbler")
+#end if
+#if $getVar("dns_name_eth0","") != ""
+ #set $my_hostname = $hostname.split('.',1)[:1][0]
+ #set $my_domainname = $dns_name_eth0.split('.',1)[1:][0]
+#else
+ #set $my_hostname = $hostname
+ #set $my_domainname = "site"
+#end if
+
+ <networking>
+ <keep_install_network config:type="boolean">false</keep_install_network>
+ <dhcp_options>
+ <dhclient_client_id></dhclient_client_id>
+ <dhclient_hostname_option></dhclient_hostname_option>
+ </dhcp_options>
+ <dns>
+ <dhcp_hostname config:type="boolean">false</dhcp_hostname>
+ <dhcp_resolv config:type="boolean">false</dhcp_resolv>
+ <write_hostname config:type="boolean">false</write_hostname>
+ <resolv_conf_policy></resolv_conf_policy>
+ <hostname>$my_hostname</hostname>
+ <domain>$my_domainname</domain>
+ #if $getVar("name_servers_search","") != ""
+ <searchlist config:type="list">
+ #for $sd in $name_servers_search
+ <search>$sd</search>
+ #end for
+ </searchlist>
+ #end if
+ <nameservers config:type="list">
+ #for $ns in $name_servers
+ <nameserver>$ns</nameserver>
+ #end for
+ </nameservers>
+ </dns>
+ <interfaces config:type="list">
+ #if $getVar("system_name","") != ""
+ #set $ikeys = $interfaces.keys()
+ #for $iface in $ikeys
+ #set $idata = $interfaces[$iface]
+ #set $mac = $idata["mac_address"]
+ #set $ip = $idata["ip_address"]
+ #set $netmask = $idata["netmask"]
+ #set $iface_type = $idata["interface_type"]
+ #set $bonding_opts = $idata["bonding_opts"]
+ #if $iface_type.lower() == "bond"
+ <interface>
+ <bonding_master>yes</bonding_master>
+ <bonding_module_opts>$bonding_opts.lower()</bonding_module_opts>
+ #set $loop_ikeys = $interfaces.keys()
+ #set $loop_counter = 0
+ #for $loop_iface in $loop_ikeys
+ #set $loop_idata = $interfaces[$loop_iface]
+ #set $loop_interface_type = $loop_idata["interface_type"]
+ #if $loop_interface_type.lower == "bond_slave"
+ #if $loop_idata["interface_master"] != ""
+ #if $loop_idata["interface_master"].lower() == $iface.lower()
+ <bonding_slave$loop_counter>$loop_iface</bonding_slave$loop_counter>
+ #set $loop_counter += 1
+ #end if
+ #end if
+ #end if
+ #end for
+ <bootproto>static</bootproto>
+ <device>$iface</device>
+ <ipaddr>$ip</ipaddr>
+ <netmask>$netmask</netmask>
+ <startmode>auto</startmode>
+ <usercontrol>no</usercontrol>
+ </interface>
+ #end if
+ #if $iface_type.lower() in ["bond_slave","bridge_slave"]
+ <interface>
+ <bootproto>none</bootproto>
+ <device>$iface</device>
+ <startmode>off</startmode>
+ <usercontrol>no</usercontrol>
+ </interface>
+ #end if
+ #if $iface_type.lower() in ["","na"]
+ <interface>
+ <bootproto>static</bootproto>
+ <device>$iface</device>
+ <lladdr>$mac.lower()</lladdr>
+ <ipaddr>$ip</ipaddr>
+ <netmask>$netmask</netmask>
+ <startmode>auto</startmode>
+ <usercontrol>no</usercontrol>
+ </interface>
+ #end if
+ #end for
+ #end if
+ </interfaces>
+ <managed config:type="boolean">false</managed>
+ <net-udev config:type="list">
+ #if $getVar("system_name","") != ""
+ #set $ikeys = $interfaces.keys()
+ #for $iface in $ikeys
+ #set $idata = $interfaces[$iface]
+ #set $mac = $idata["mac_address"]
+ #set $interface_type = $idata["interface_type"]
+ #if $mac.lower() != ""
+ #if $interface_type.lower() not in ["bond","bridge"]
+ <rule>
+ <name>$iface</name>
+ <rule>ATTR{address}</rule>
+ <value>$mac.lower()</value>
+ </rule>
+ #end if
+ #end if
+ #end for
+ #end if
+ </net-udev>
+ <routing>
+ <ip_forward config:type="boolean">false</ip_forward>
+ #if $getVar("system_name","") != ""
+ ## TODO: add in static routes here
+ <routes config:type="list">
+ <route>
+ <destination>default</destination>
+ <netmask>-</netmask>
+ <device>-</device>
+ <gateway>$gateway</gateway>
+ </route>
+ </routes>
+ #end if
+ </routing>
+ </networking>