Sample Autoinstallation Script

This section contains example autoinstallation scripts.

If you use these profiles, check which variables they use. When the uploaded profile requires variables to be set, navigate to Systems  Autoinstallation  Profiles, select the profile to edit, and navigate to the Variables tab. Specify the required variables, using this format:

<key>=<value>

For all installations, the $redhat_management_server variable will be set automatically and does not need to be defined.

These examples use the $distrotree variable, which must be defined as the distribution label used with this profile. Set the variable to the same value that you selected in Autoinstall Tree in the Details tab. Example:

distrotree=sles_sap15sp2-x86_64

when the distribution label is sles_sap15sp2-x86_64.

Upgrading from SLES 12 SPn to SLES 15 SP2

Use this script as the basis for an upgrade from SLES 12 SPn to SLES 15 SP2. Check the official product documentation to find the supported upgrade paths.

Example: Script for Upgrading from SLES 12 SPn to SLES 15 SP2
<?xml version="1.0"?>
<!DOCTYPE profile>
<profile xmlns="http://www.suse.com/1.0/yast2ns"
         xmlns:config="http://www.suse.com/1.0/configns">
  <general>
  $SNIPPET('spacewalk/sles_no_signature_checks')
    <mode>
      <confirm config:type="boolean">false</confirm>
    </mode>
  </general>
  <add-on>
    <add_on_products config:type="list">
      <listentry>
        <ask_on_error config:type="boolean">true</ask_on_error>
        <media_url>http://$redhat_management_server/ks/dist/child/sle-product-sles15-sp2-updates-x86_64/$distrotree</media_url>
        <name>SLE-Product-SLES15-SP2-Updates for x86_64</name>
        <product>SUSE Linux Enterprise Server 15 SP2 x86_64</product>
        <product_dir>/</product_dir>
      </listentry>
      <listentry>
        <ask_on_error config:type="boolean">true</ask_on_error>
        <media_url>http://$redhat_management_server/ks/dist/child/sle-manager-tools15-pool-x86_64-sp2/$distrotree</media_url>
        <name>SLE-Manager-Tools15-Pool for x86_64 SP2</name>
        <product>SUSE Manager Tools 15 x86_64</product>
        <product_dir>/</product_dir>
      </listentry>
      <listentry>
        <ask_on_error config:type="boolean">true</ask_on_error>
        <media_url>http://$redhat_management_server/ks/dist/child/sle-manager-tools15-updates-x86_64-sp2/$distrotree</media_url>
        <name>SLE-Manager-Tools15-Updates for x86_64 SP2</name>
        <product>SUSE Manager Tools 15 x86_64</product>
        <product_dir>/</product_dir>
      </listentry>
      <listentry>
        <ask_on_error config:type="boolean">true</ask_on_error>
        <media_url>http://$redhat_management_server/ks/dist/child/sle-module-basesystem15-sp2-pool-x86_64/$distrotree</media_url>
        <name>SLE-Module-Basesystem15-SP2-Pool for x86_64</name>
        <product>Basesystem Module 15 SP2 x86_64</product>
        <product_dir>/</product_dir>
      </listentry>
      <listentry>
        <ask_on_error config:type="boolean">true</ask_on_error>
        <media_url>http://$redhat_management_server/ks/dist/child/sle-module-basesystem15-sp2-updates-x86_64/$distrotree</media_url>
        <name>SLE-Module-Basesystem15-SP2-Updates for x86_64</name>
        <product>Basesystem Module 15 SP2 x86_64</product>
        <product_dir>/</product_dir>
      </listentry>
      <listentry>
        <ask_on_error config:type="boolean">true</ask_on_error>
        <media_url>http://$redhat_management_server/ks/dist/child/sle-module-server-applications15-sp2-pool-x86_64/$distrotree</media_url>
        <name>SLE-Module-Server-Applications15-SP2-Pool for x86_64</name>
        <product>Server Applications Module 15 SP2 x86_64</product>
        <product_dir>/</product_dir>
      </listentry>
      <listentry>
        <ask_on_error config:type="boolean">true</ask_on_error>
        <media_url>http://$redhat_management_server/ks/dist/child/sle-module-server-applications15-sp2-updates-x86_64/$distrotree</media_url>
        <name>SLE-Module-Server-Applications15-SP2-Updates for x86_64</name>
        <product>Server Applications Module 15 SP2 x86_64</product>
        <product_dir>/</product_dir>
      </listentry>
    </add_on_products>
  </add-on>
  <upgrade>
    <only_installed_packages config:type="boolean">false</only_installed_packages>
    <stop_on_solver_conflict config:type="boolean">true</stop_on_solver_conflict>
  </upgrade>
  <backup>
    <sysconfig config:type="boolean">true</sysconfig>
    <modified config:type="boolean">true</modified>
    <remove_old config:type="boolean">false</remove_old>
  </backup>
  <networking>
    <keep_install_network config:type="boolean">true</keep_install_network>
    <start_immediately config:type="boolean">true</start_immediately>
  </networking>
   <scripts>
    <init-scripts config:type="list">
      $SNIPPET('spacewalk/minion_script')
<!-- when client is traditional registered, please use this snippet
      $SNIPPET('spacewalk/sles_register_script')
-->
    </init-scripts>
  </scripts>
</profile>

Upgrading a Uyuni Proxy from 3.2 to 4.1

Use this script as the basis for an upgrade from Uyuni Proxy 3.2 to Uyuni Proxy 4.1.

Example: Script for Upgrading from Uyuni Proxy 3.2 to Uyuni Proxy 4.1
<?xml version="1.0"?>
<!DOCTYPE profile>
<profile xmlns="http://www.suse.com/1.0/yast2ns" xmlns:config="http://www.suse.com/1.0/configns">
  <add-on>
    <add_on_products config:type="list">
      <listentry>
        <ask_on_error config:type="boolean">true</ask_on_error>
        <media_url>http://$redhat_management_server/ks/dist/child/sle-product-suse-manager-proxy-4.1-updates-x86_64/$distrotree</media_url>
        <name>sle-product-suse-manager-proxy-4.1-updates-x86_64</name>
        <product>SUSE Manager Proxy 4.1</product>
        <product_dir>/</product_dir>
      </listentry>
      <listentry>
        <ask_on_error config:type="boolean">true</ask_on_error>
        <media_url>http://$redhat_management_server/ks/dist/child/sle-module-basesystem15-sp2-pool-x86_64-proxy-4.1/$distrotree</media_url>
        <name>sle-module-basesystem15-sp2-pool-x86_64-proxy-4.1</name>
        <product>SUSE Manager Proxy 4.1</product>
        <product_dir>/</product_dir>
      </listentry>
      <listentry>
        <ask_on_error config:type="boolean">true</ask_on_error>
        <media_url>http://$redhat_management_server/ks/dist/child/sle-module-basesystem15-sp2-updates-x86_64-proxy-4.1/$distrotree</media_url>
        <name>sle-module-basesystem15-sp2-updates-x86_64-proxy-4.1</name>
        <product>SUSE Manager Proxy 4.1</product>
        <product_dir>/</product_dir>
      </listentry>
      <listentry>
        <ask_on_error config:type="boolean">true</ask_on_error>
        <media_url>http://$redhat_management_server/ks/dist/child/sle-module-server-applications15-sp2-pool-x86_64-proxy-4.1/$distrotree</media_url>
        <name>sle-module-server-applications15-sp2-pool-x86_64-proxy-4.1</name>
        <product>SUSE Manager Proxy 4.1</product>
        <product_dir>/</product_dir>
      </listentry>
      <listentry>
        <ask_on_error config:type="boolean">true</ask_on_error>
        <media_url>http://$redhat_management_server/ks/dist/child/sle-module-server-applications15-sp2-updates-x86_64-proxy-4.1/$distrotree</media_url>
        <name>sle-module-server-applications15-sp2-updates-x86_64-proxy-4.1</name>
        <product>SUSE Manager Proxy 4.1</product>
        <product_dir>/</product_dir>
      </listentry>
      <listentry>
        <ask_on_error config:type="boolean">true</ask_on_error>
        <media_url>http://$redhat_management_server/ks/dist/child/sle-module-suse-manager-proxy-4.1-pool-x86_64/$distrotree</media_url>
        <name>sle-module-suse-manager-proxy-4.1-pool-x86_64</name>
        <product>SUSE Manager Proxy 4.1</product>
        <product_dir>/</product_dir>
      </listentry>
      <listentry>
        <ask_on_error config:type="boolean">true</ask_on_error>
        <media_url>http://$redhat_management_server/ks/dist/child/sle-module-suse-manager-proxy-4.1-updates-x86_64/$distrotree</media_url>
        <name>sle-module-suse-manager-proxy-4.1-updates-x86_64</name>
        <product>SUSE Manager Proxy 4.1</product>
        <product_dir>/</product_dir>
      </listentry>
     </add_on_products>
  </add-on>
  <general>
      $SNIPPET('spacewalk/sles_no_signature_checks')
    <mode><confirm config:type="boolean">false</confirm></mode>
  </general>
  <upgrade>
    <only_installed_packages config:type="boolean">false</only_installed_packages>
    <stop_on_solver_conflict config:type="boolean">true</stop_on_solver_conflict>
  </upgrade>
  <backup>
    <sysconfig config:type="boolean">true</sysconfig>
    <modified config:type="boolean">true</modified>
    <remove_old config:type="boolean">false</remove_old>
  </backup>
  <networking>
    <keep_install_network config:type="boolean">true</keep_install_network>
    <start_immediately config:type="boolean">true</start_immediately>
  </networking>
  <software>
    <image/>
    <install_recommended config:type="boolean">true</install_recommended>
    <instsource/>
    <patterns config:type="list">
      <pattern>suma_proxy</pattern>
    </patterns>
    <products config:type="list">
      <listentry>SUSE-Manager-Proxy</listentry>
    </products>
  </software>
  <scripts>
    <chroot-scripts config:type="list">
      <script>
        <filename>cleanup.sh</filename>
        <chrooted config:type="boolean">true</chrooted>
        <interpreter>shell</interpreter>
        <source>
        <![CDATA[
#!/bin/sh
         sysconf_addword /etc/sysconfig/apache2 APACHE_MODULES wsgi
         if [ -e /etc/rhn/rhn.conf.rpmsave ]; then
             cp /etc/rhn/rhn.conf.rpmsave /etc/rhn/rhn.conf
         fi
         zypper rr --all
         ]]>
        </source>
      </script>
    </chroot-scripts>
    <init-scripts config:type="list">
      $SNIPPET('spacewalk/minion_script')
<!-- when client is traditional registered, please use this snippet
      $SNIPPET('spacewalk/sles_register_script')
-->
    </init-scripts>
  </scripts>
</profile>

Upgrading an SAP Client from SLE 12 to SLE 15 SP2

Use this script as the basis for an upgrade from SLE 12 SPn to SLE 15.1. Check the official product documentation to find the supported upgrade paths.

Example: Script for Upgrading an SAP Client from SLE 12 SP4 to SLE 15
<?xml version="1.0"?>
<!DOCTYPE profile>
<profile xmlns="http://www.suse.com/1.0/yast2ns" xmlns:config="http://www.suse.com/1.0/configns">
  <add-on>
    <add_on_products config:type="list">
      <listentry>
        <ask_on_error config:type="boolean">true</ask_on_error>
        <media_url>http://$redhat_management_server/ks/dist/child/sle-product-sles_sap15-sp2-updates-x86_64/$distrotree</media_url>
        <name>SLE-Product-SLES_SAP15-SP2-Pool for x86_64</name>
        <product>SUSE Linux Enterprise Server for SAP Applications 15 SP2 x86_64</product>
        <product_dir>/</product_dir>
      </listentry>
       <listentry>
        <ask_on_error config:type="boolean">true</ask_on_error>
        <media_url>http://$redhat_management_server/ks/dist/child/sle-manager-tools15-pool-x86_64-sap-sp2/$distrotree</media_url>
        <name>SLE-Manager-Tools15-Pool for x86_64 SAP SP2</name>
        <product>SUSE Manager Tools 15 x86_64</product>
        <product_dir>/</product_dir>
      </listentry>
      <listentry>
        <ask_on_error config:type="boolean">true</ask_on_error>
        <media_url>http://$redhat_management_server/ks/dist/child/sle-manager-tools15-updates-x86_64-sap-sp2/$distrotree</media_url>
        <name>SLE-Manager-Tools15-Updates for x86_64 SAP SP2</name>
        <product>SUSE Manager Tools 15 x86_64</product>
        <product_dir>/</product_dir>
      </listentry>
      <listentry>
        <ask_on_error config:type="boolean">true</ask_on_error>
        <media_url>http://$redhat_management_server/ks/dist/child/sle-module-basesystem15-sp2-pool-x86_64-sap/$distrotree</media_url>
        <name>SLE-Module-Basesystem15-SP2-Pool for x86_64 SAP</name>
        <product>Basesystem Module 15 SP2 x86_64</product>
        <product_dir>/</product_dir>
      </listentry>
      <listentry>
        <ask_on_error config:type="boolean">true</ask_on_error>
        <media_url>http://$redhat_management_server/ks/dist/child/sle-module-basesystem15-sp2-updates-x86_64-sap/$distrotree</media_url>
        <name>SLE-Module-Basesystem15-SP2-Updates for x86_64 SAP</name>
        <product>Basesystem Module 15 SP2 x86_64</product>
        <product_dir>/</product_dir>
      </listentry>
      <listentry>
        <ask_on_error config:type="boolean">true</ask_on_error>
        <media_url>http://$redhat_management_server/ks/dist/child/sle-module-desktop-applications15-sp2-pool-x86_64-sap/$distrotree</media_url>
        <name>SLE-Module-Desktop-Applications15-SP2-Pool for x86_64 SAP</name>
        <product>Desktop Applications Module 15 SP2 x86_64 </product>
        <product_dir>/</product_dir>
      </listentry>
      <listentry>
        <ask_on_error config:type="boolean">true</ask_on_error>
        <media_url>http://$redhat_management_server/ks/dist/child/sle-module-desktop-applications15-sp2-updates-x86_64-sap/$distrotree</media_url>
        <name>SLE-Module-Desktop-Applications15-SP2-Updates for x86_64 SAP</name>
        <product>Desktop Applications Module 15 SP2 x86_64 </product>
        <product_dir>/</product_dir>
      </listentry>
      <listentry>
        <ask_on_error config:type="boolean">true</ask_on_error>
        <media_url>http://$redhat_management_server/ks/dist/child/sle-module-server-applications15-sp2-pool-x86_64-sap/$distrotree</media_url>
        <name>SLE-Module-Server-Applications15-SP2-Pool for x86_64 SAP</name>
        <product>Server Applications Module 15 SP2 x86_64</product>
        <product_dir>/</product_dir>
      </listentry>
      <listentry>
        <ask_on_error config:type="boolean">true</ask_on_error>
        <media_url>http://$redhat_management_server/ks/dist/child/sle-module-server-applications15-sp2-updates-x86_64-sap/$distrotree</media_url>
        <name>SLE-Module-Server-Applications15-SP2-Updates for x86_64 SAP</name>
        <product>Server Applications Module 15 SP2 x86_64</product>
        <product_dir>/</product_dir>
      </listentry>
      <listentry>
        <ask_on_error config:type="boolean">true</ask_on_error>
        <media_url>http://$redhat_management_server/ks/dist/child/sle-product-ha15-sp2-pool-x86_64-sap/$distrotree</media_url>
        <name>SLE-Product-HA15-SP2-Pool for x86_64 SAP</name>
        <product>SUSE Linux Enterprise High Availability Extension 15 SP2 x86_64</product>
        <product_dir>/</product_dir>
      </listentry>
      <listentry>
        <ask_on_error config:type="boolean">true</ask_on_error>
        <media_url>http://$redhat_management_server/ks/dist/child/sle-product-ha15-sp2-updates-x86_64-sap/$distrotree</media_url>
        <name>SLE-Product-HA15-SP2-Updates for x86_64 SAP</name>
        <product>SUSE Linux Enterprise High Availability Extension 15 SP2 x86_64 </product>
        <product_dir>/</product_dir>
      </listentry>
      <listentry>
        <ask_on_error config:type="boolean">true</ask_on_error>
        <media_url>http://$redhat_management_server/ks/dist/child/sle-module-sap-applications15-sp2-pool-x86_64/$distrotree</media_url>
        <name>SLE-Module-SAP-Applications15-SP2-Pool for x86_64</name>
        <product>SAP Applications Module 15 SP2 x86_64</product>
        <product_dir>/</product_dir>
      </listentry>
      <listentry>
        <ask_on_error config:type="boolean">true</ask_on_error>
        <media_url>http://$redhat_management_server/ks/dist/child/sle-module-sap-applications15-sp2-updates-x86_64/$distrotree</media_url>
        <name>SLE-Module-SAP-Applications15-SP2-Updates for x86_64</name>
        <product>SAP Applications Module 15 SP2 x86_64</product>
        <product_dir>/</product_dir>
      </listentry>
      <listentry>
        <ask_on_error config:type="boolean">true</ask_on_error>
        <media_url>http://$redhat_management_server/ks/dist/child/sle-module-python2-15-sp2-pool-x86_64-sap/$distrotree</media_url>
        <name>SLE-Module-Python2-15-SP2-Pool for x86_64 SAP</name>
        <product>Python 2 Module 15 SP2 x86_64</product>
        <product_dir>/</product_dir>
      </listentry>
      <listentry>
        <ask_on_error config:type="boolean">true</ask_on_error>
        <media_url>http://$redhat_management_server/ks/dist/child/sle-module-python2-15-sp2-updates-x86_64-sap/$distrotree</media_url>
        <name>SLE-Module-Python2-15-SP2-Updates for x86_64 SAP</name>
        <product>Python 2 Module 15 SP2 x86_64 </product>
        <product_dir>/</product_dir>
      </listentry>
     </add_on_products>
  </add-on>
  <general>
      $SNIPPET('spacewalk/sles_no_signature_checks')
    <mode><confirm config:type="boolean">false</confirm></mode>
    <storage>
      <partition_alignment config:type="symbol">align_optimal</partition_alignment>
      <start_multipath config:type="boolean">false</start_multipath>
    </storage>
  </general>
  <upgrade>
    <only_installed_packages config:type="boolean">false</only_installed_packages>
    <stop_on_solver_conflict config:type="boolean">true</stop_on_solver_conflict>
  </upgrade>
  <backup>
    <sysconfig config:type="boolean">true</sysconfig>
    <modified config:type="boolean">true</modified>
    <remove_old config:type="boolean">false</remove_old>
  </backup>
  <networking>
    <keep_install_network config:type="boolean">true</keep_install_network>
    <start_immediately config:type="boolean">true</start_immediately>
  </networking>
  <software>
    <image/>
    <install_recommended config:type="boolean">true</install_recommended>
    <instsource/>
    <patterns/>
    <products config:type="list">
      <listentry>SLES_SAP</listentry>
    </products>
  </software>
  <scripts>
    <init-scripts config:type="list">
      $SNIPPET('spacewalk/minion_script')
<!-- when client is traditional registered, please use this snippet
      $SNIPPET('spacewalk/sles_register_script')
-->
    </init-scripts>
  </scripts>
</profile>