Skip to content

Commit

Permalink
Have autoyast by default behave more like RHEL, regarding networking …
Browse files Browse the repository at this point in the history
…etc.
  • Loading branch information
christianhorn committed Feb 5, 2012
1 parent 8f4c70a commit 2ba13cd
Show file tree
Hide file tree
Showing 3 changed files with 185 additions and 148 deletions.
69 changes: 46 additions & 23 deletions kickstarts/autoyast_sample.xml
@@ -1,30 +1,33 @@
<!--
Copyright (c) 2011 Novell
Uwe Gansert ug@suse.de
This software is licensed to you under the GNU General Public License,
version 2 (GPLv2). There is NO WARRANTY for this software, express or
implied, including the implied warranties of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
along with this software; if not, see
http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
-->
<?xml version="1.0"?>
<!DOCTYPE profile>
<profile xmlns="http://www.suse.com/1.0/yast2ns" xmlns:config="http://www.suse.com/1.0/configns">
<networking>
<keep_install_network config:type="boolean">true</keep_install_network>
</networking>
<software>
<patterns config:type="list">
<pattern>base</pattern>
</patterns>
</software>
<deploy_image>
<image_installation config:type="boolean">false</image_installation>
</deploy_image>
## without the next 6 lines autoyast will ask for confirmation bevore installation
<general>
<mode>
<confirm config:type="boolean">false</confirm>
<final_reboot config:type="boolean">true</final_reboot>
</mode>
</general>
$SNIPPET('hosts.xml')
$SNIPPET('kdump.xml')
<keyboard>
<keymap>english</keymap>
</keyboard>
<language>
<language>en_US</language>
<languages></languages>
</language>
<login_settings/>
$SNIPPET('networking.xml')
<runlevel>
<default>3</default>
</runlevel>
<users config:type="list">
<user>
<encrypted config:type="boolean">false</encrypted>
<encrypted config:type="boolean">true</encrypted>
<fullname>root</fullname>
<gid>0</gid>
<home>/root</home>
Expand All @@ -38,8 +41,28 @@
</password_settings>
<shell>/bin/bash</shell>
<uid>0</uid>
<user_password>s3cr3t</user_password>
## password: cobbler
<user_password>$2a$05$OByGoYrDs05U3L62Sy0G4uMPsIx3JcUM5SBshs0xL0H6VYDFAvvGy</user_password>
<username>root</username>
</user>
</users>
<scripts>
## we have to include the pre-scripts tag to get kickstart_start included
<pre-scripts config:type="list">
</pre-scripts>
<post-scripts config:type="list">

## This plugin wrapper provides the flexibility to call pure shell
## snippets which can be used directly on kickstart and with with
## wrapper on SuSE.
##
## To use it
## - exchange name_of_pure_shell_snippet with the name of this shell snippet
## - and remove the '##' in front of the line with suse_scriptwrapper.xml
##
#set global $wrappedscript = 'name_of_pure_shell_snippet'
## $SNIPPET('suse_scriptwrapper.xml')

</post-scripts>
</scripts>
</profile>
44 changes: 22 additions & 22 deletions snippets/SuSE/hosts.xml
@@ -1,23 +1,23 @@
<host>
<hosts config:type="list">
<hosts_entry>
<host_address>127.0.0.1</host_address>
<names config:type="list">
<name>localhost</name>
</names>
</hosts_entry>
#set $ikeys = $interfaces.keys()
#for $iface in $ikeys
#set $idata = $interfaces[$iface]
#if $idata["interface_type"].lower() in ["","na","bridge","bond"]
<hosts_entry>
<host_address>$idata["ip_address"]</host_address>
<names config:type="list">
#set $my_interface_hostname_short = $idata["dns_name"].split('.',1)[:1][0]
<name>$idata["dns_name"].lower() $my_interface_hostname_short.lower()</name>
</names>
</hosts_entry>
#end if
#end for
</hosts>
</host>
<hosts config:type="list">
<hosts_entry>
<host_address>127.0.0.1</host_address>
<names config:type="list">
<name>localhost</name>
</names>
</hosts_entry>
#set $ikeys = $interfaces.keys()
#for $iface in $ikeys
#set $idata = $interfaces[$iface]
#if $idata["interface_type"].lower() in ["","na","bridge","bond"]
<hosts_entry>
<host_address>$idata["ip_address"]</host_address>
<names config:type="list">
#set $my_interface_hostname_short = $idata["dns_name"].split('.',1)[:1][0]
<name>$idata["dns_name"].lower() $my_interface_hostname_short.lower()</name>
</names>
</hosts_entry>
#end if
#end for
</hosts>
</host>
220 changes: 117 additions & 103 deletions snippets/SuSE/networking.xml
@@ -1,107 +1,121 @@
#if $hostname == ""
#set $hostname = $system_name
#set $hostname = $system_name
#end if
#set $my_hostname = $hostname.split('.',1)[:1][0]
#set $my_domainname = $hostname.split('.',1)[1:][0]
<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>
#if $getVar("dns_name_eth0","") != ""
#set $my_hostname = $hostname.split('.',1)[:1][0]
#set $my_domainname = $dns_name_eth0
#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">
#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
</searchlist>
#end if
<nameservers config:type="list">
#for $ns in $name_servers
<nameserver>$ns</nameserver>
</interfaces>
<managed config:type="boolean">false</managed>
<net-udev config:type="list">
#set $ikeys = $interfaces.keys()
#for $iface in $ikeys
#set $idata = $interfaces[$iface]
#set $mac = $idata["mac_address"]
#set $interface_type = $idata["interface_type"]
#if $interface_type.lower() not in ["bond","bridge"]
<rule>
<name>$iface</name>
<rule>ATTR{address}</rule>
<value>$mac.lower()</value>
</rule>
#end if
#end for
</nameservers>
</dns>
<interfaces config:type="list">
#set $ikeys = $interfaces.keys()
#for $iface in $ikeys
#set $idata = $interfaces[$iface]
#if $idata["interface_type"].lower() == "bond"
<interface>
<bonding_master>yes</bonding_master>
<bonding_module_opts>$idata["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]
#if $loop_idata["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>$idata["ip_address"]</ipaddr>
<netmask>$idata["subnet"]</netmask>
<startmode>auto</startmode>
<usercontrol>no</usercontrol>
</interface>
#end if
#if $idata["interface_type"].lower() in ["bond_slave","bridge_slave"]
<interface>
<bootproto>none</bootproto>
<device>$iface</device>
<startmode>off</startmode>
<usercontrol>no</usercontrol>
</interface>
#end if
#if $idata["interface_type"].lower() in ["","na"]
<interface>
<bootproto>static</bootproto>
<device>$iface</device>
<lladdr>$idata["mac_address"].lower()</lladdr>
<ipaddr>$idata["ip_address"]</ipaddr>
<netmask>$idata["subnet"]</netmask>
<startmode>auto</startmode>
<usercontrol>no</usercontrol>
</interface>
#end if
#end for
</interfaces>
<managed config:type="boolean">false</managed>
<net-udev config:type="list">
#set $ikeys = $interfaces.keys()
#for $iface in $ikeys
#set $idata = $interfaces[$iface]
#if $idata["interface_type"].lower() not in ["bond","bridge"]
<rule>
<name>$iface</name>
<rule>ATTR{address}</rule>
<value>$idata["mac_address"].lower()</value>
</rule>
#end if
#end for
</net-udev>
<routing>
<ip_forward config:type="boolean">false</ip_forward>
<routes config:type="list">
<route>
<destination>default</destination>
<netmask>-</netmask>
<device>-</device>
<gateway>$gateway</gateway>
</route>
</routes>
</routing>
</networking>
</net-udev>
<routing>
<ip_forward config:type="boolean">false</ip_forward>
<routes config:type="list">
<route>
<destination>default</destination>
<netmask>-</netmask>
<device>-</device>
<gateway>$gateway</gateway>
</route>
</routes>
</routing>
</networking>

0 comments on commit 2ba13cd

Please sign in to comment.