Autoinstallation Profiles

An autoinstallation profile determines how the operating system will be installed. For example, you can specify additional kernel parameters to be passed to the installer.

The most important part of the profile is the "autoinstallation file." When you perform an installation manually, you must provide information to the installer, such as partitioning and networking information and user details. The autoinstallation file is a method of providing this information in a scripted form. This type of file is sometimes also referred to as an "answers file."

Within SUSE Manager, you can use two different types of profiles, depending on the operating system of the clients you want to install:

  • For SUSE Linux Enterprise or openSUSE clients, use AutoYaST.

  • For Red Hat Enterprise Linux clients, use Kickstart.

You can use both AutoYaST and Kickstart profiles if you want to install clients with different operating systems.

The autoinstallation file contained in the profile can include variables and code snippets. For information about variables and code snippets, see Templates Syntax.

1. Declare the Profile

When you have prepared an autoinstallation file and distribution, you can create profiles to manage autoinstallation on your SUSE Manager Server. The profile will determine how to install this distribution you selected. One way to create a profile is to upload an AutoYaST or Kickstart file. Alternatively, for Kickstart only, you can use the Web UI wizard.

Procedure: Creating an Autoinstallation Profile by Upload
  1. In the SUSE Manager Web UI, navigate to Systems  Autoinstallation  Profiles.

  2. Click Upload Kickstart/AutoYaST File.

  3. In the Label field, type a name for the profile. Do not use spaces.

  4. In the Autoinstall Tree field, select the autoinstallable distribution to use for this profile.

  5. In the Virtualization Type field, select the type of virtualization to use for this profile, or select None if you do not want to use this profile to create a new virtual machine.

  6. Copy the contents of your autoinstallation file into the File Contents field, or upload the file directly using the File to Upload field.

    For more information about the details to include here, see AutoYaST Profiles or Kickstart Profiles.

  7. Click Create to create the profile.

Procedure: Creating a Kickstart Profile by Wizard
  1. In the SUSE Manager Web UI, navigate to Systems  Autoinstallation  Profiles.

  2. Click Create Kickstart Profile.

  3. In the Label field, type a name for the profile. Do not use spaces.

  4. In the Base Channel field, select the base channel to use for this profile. This field is populated from the distributions available. If the base channel you need is not available, check that you have created the distribution correctly.

  5. In the Virtualization Type field, select the type of virtualization to use for this profile, or select None for no virtualization.

  6. Click Next.

  7. In the Distribution File Location type the path to the installation media installed on the SUSE Manager Server.

  8. Click Next.

  9. Provide a password for the root user on the client.

  10. Click Finish.

  11. Review the details of your new profile, and customize as required.

When you are creating your autoinstallation profile, you can check Always use the newest Tree for this base channel. This setting allows SUSE Manager to automatically pick the latest distribution that is associated with the specified base channel. If you add new distributions later, SUSE Manager uses the most recently created or modified.

Changing the Virtualization Type usually requires changes to the profile bootloader and partition options. This can overwrite your customization. Verify new or changed settings before saving them, by navigating to the Partitioning tab.

The kernel options from the distribution and the profile are combined.

You can change the details and settings of your autoinstallation profiles by navigating to Systems  Autoinstallation  Profiles and clicking the name of the profile you want to edit. Alternatively, navigate to Systems  System List, select the client you want to provision, and navigate to the Provisioning  Autoinstallation subtab.

2. AutoYaST Profiles

An AutoYaST profile consists of a Label that identifies the profile, an Autoinstall Tree that points to an autoinstallable distribution, various options, and, most importantly, an AutoYaST installation file.

The AutoYaST installation file is an XML file that give directions to the AutoYaST installer. AutoYaST calls it a "control file." For the full syntax of AutoYaST installation files, see https://doc.opensuse.org/projects/autoyast/#cha-configuration-installation-options.

SUSE provides templates of AutoYaST installation files that you can use as a starting point for your own custom files. You will find the templates at https://github.com/SUSE/manager-build-profiles in the AutoYast directory. Each of these profiles requires you to set some variables before you use it. Check the README file included with the script to determine which variables you need. For more information about using variables in AutoYaST scripts, see Variables.

These are the most important sections in the AutoYaST installation file for installing with SUSE Manager:

For more information about AutoYaST, see https://doc.opensuse.org/projects/autoyast/.

A more recent, Salt-based alternative to AutoYaST, is Yomi. For information about Yomi, see Install with Yomi.

3. Kickstart Profiles

Kickstart profiles offer a large number of configuration options. To create these profiles, you can upload them, or use a dedicated wizard.

Kickstart profiles allow you to use file preservation lists. If you have many custom configuration files located on a client you want to reinstall with Kickstart, you can save them as a list, and associate that list with the Kickstart profile.

Procedure: Creating a File Preservation List
  1. In the SUSE Manager Web UI, navigate to Systems  Autoinstallation  File Preservation and click Create File Preservation List.

  2. Enter a suitable label, and list absolute paths to all files and directories you want to save.

  3. Click Create List.

  4. Include the file preservation list in your Kickstart profile.

  5. Navigate to Systems  Autoinstallation  Profiles and select the profile you want to edit, go to the System Details  File Preservation subtab, and select the file preservation list to include.

File preservation lists are limited to a total size of 1 MB. Special devices like /dev/hda1 and /dev/sda1 cannot be preserved. Only use file and directory names, you cannot use regular expression wildcards.

For more information about Kickstart, see the Red Hat documentation.

4. Templates Syntax

Parts of your installation file are replaced during the installation. Variables are replaced with single values, and code snippets are replaced with whole sections of text. Escaped symbols or sections are not replaced.

A template engine called Cheetah allows Cobbler to do these replacements. This mechanism allows you to reinstall large numbers of systems, without having to manually create profiles for each of them.

You can create autoinstallation variables and code snippets within the SUSE Manager Web UI. Within a profile, the Autoinstallation File tab allows you to see the result of the substitutions.

  • For information about variables, see Variables.

  • For information about code snippets, see Code Snippets.

  • For information about escaping symbols or text blocks, see Escaping.

4.1. Variables

Autoinstallation variables can be used to substitute values into Kickstart and AutoYaST profiles. To define a variable, from the profile, navigate to the Variables subtab, and create a name=value pair in the text box.

For example, you could create a variable that holds the IP address of the client, and another that holds the address of its gateway. Those variables can then be defined for all the clients installed from the same profile. To do that, add these lines to the Variables text box:

ipaddr=192.168.0.28
gateway=192.168.0.1

To use the variable, prepend a $ sign in the profile to substitute the value. For example, the network part of a Kickstart file may look like the following:

network --bootproto=static --device=eth0 --onboot=on --ip=$ipaddr \
  --gateway=$gateway

The $ipaddr is resolved to 192.168.0.28, and the $gateway to 192.168.0.1.

In installation files, variables use a hierarchy. System variables take precedence over profile variables, which in turn take precedence over distribution variables.

4.2. Code Snippets

SUSE Manager comes with a large number of predefined code snippets. Navigate to Systems  Autoinstallation  Autoinstallation Snippets to see the list of existing snippets.

Use a snippet by inserting the $SNIPPET() macro in your autoinstallation file. For example, in Kickstart:

$SNIPPET('spacewalk/rhel_register_script')

Or, in AutoYaST:

<init-scripts config:type="list">
  $SNIPPET('spacewalk/sles_register_script')
</init-scripts>

The macro is parsed by Cobbler and substituted with the contents of the snippet. You can also store your own code snippets to use in autoinstallation files later on. Click Create Snippet to create a new code snippet.

This example sets up a Kickstart snippet for a common hard drive partition configuration:

clearpart --all
part /boot --fstype ext3 --size=150 --asprimary
part / --fstype ext3 --size=40000 --asprimary
part swap --recommended

part pv.00 --size=1 --grow

volgroup vg00 pv.00
logvol /var --name=var vgname=vg00 --fstype ext3 --size=5000

Use the snippet with, for example:

$SNIPPET('my_partition')

4.3. Escaping

If the autoinstallation file contains shell script variables like $(example), the content needs to be escaped with a backslash: \$(example). Escaping the $ symbol prevents the templating engine from evaluating the symbol as an internal variable.

Text blocks such as code fragments or scripts can be escaped by wrapping them with the \#raw and \#end raw directives. For example:

#raw
#!/bin/bash
for i in {0..2}; do
 echo "$i - Hello World!"
done
#end raw

Any line with a # symbol followed by a whitespace is treated as a comment and is therefore not evaluated. For example:

# start some section (this is a comment)
echo "Hello, world"
# end some section (this is a comment)