To create the control file, you need to collect information about the systems you are going to install. This includes hardware data and network information among other things. Make sure you have the following information about the machines you want to install:
Hard disk types and sizes
Graphical interface and attached monitor, if any
Network interface and MAC address if known (for example, when using DHCP)
Also verify that both autoyast2-installation and autoyast2 are installed.
To create the control file for one or more computers, a configuration interface based on YaST is provided. This system depends on existing modules which are usually used to configure a computer in regular operation mode, for example, after openSUSE Leap is installed.
The configuration management system lets you easily create control files and manage a repository of configurations for use in a networked environment with multiple clients.
The easiest way to create an AutoYaST profile is to use an existing
openSUSE Leap system
as a template. On an already installed system, start › › . Now select › from the menu. Choose the system components you want
to include in the profile. Alternatively, create a profile containing
the complete system configuration by running sudo yast
clone_system
from the command line.
Both methods will create the file
/root/autoinst.xml
. The version created on the
command line can be used to set up an identical clone of the system on
which the profile was created. However, usually you will want to adjust
the file to make it possible to install several machines that are very
similar, but not identical. This can be done by adjusting the profile
using your favorite text/XML editor.
With some exceptions, almost all resources of the control file can be configured using the configuration management system. The system offers flexibility and the configuration of some resources is identical to the one available in the YaST control center. In addition to the existing and familiar modules new interfaces were created for special and complex configurations, for example for partitioning, general options and software.
Furthermore, using a CMS guarantees the validity of the resulting control file and its direct use for starting automated installation.
Make sure the configuration system is installed (package
autoyast2
) and call it using
the YaST control center or as root with the following command
(make sure the DISPLAY
variable is set correctly to
start the graphical user interface instead of the text-based one):
/sbin/yast2 autoyast
If editing the control file manually, make sure it has a valid syntax. To
check the syntax, use the tools already available on the distribution. For
example, to verify that the file is well-formed (has a valid XML
structure), use the utility xmllint
available with the
libxml2
package:
xmllint <control file>
If the control file is not well formed, for example, if a tag is not
closed, xmllint
will report the errors.
To validate the control file, use the tool jing
from the
package with the same name. During validation, misplaced or missing tags and
attributes and wrong attribute values are detected.
jing /usr/share/YaST2/schema/autoyast/rng/profile.rng <control file>
/usr/share/YaST2/schema/autoyast/rng/profile.rng
is
provided by the package yast2-schema
. This file
describes the syntax and classes of an AutoYaST profile.
Before going on with the autoinstallation, fix any errors resulting from such checks. The autoinstallation process cannot be started with an invalid and not well-formed control file.
You can use any XML editor available on your system or any text editor with XML support (for example, Emacs, Vim). However, it is not optimal to create the control file manually for many machines and it should only be seen as an interface between the autoinstallation engine and the Configuration Management System (CMS).
The built-in nxml-mode turns Emacs into a fully-fledged XML editor with automatic tag completion and validation. Refer to the Emacs help for instructions on how to set up nxml-mode.
If you have a template and want to change a few things via script or
command line, use an XSLT processor like xsltproc
.
For example, if you have an AutoYaST control file and want to fill out
the host name via script for any reason. (If doing this often, you
should consider scripting it.)
First, create an XSL file:
<?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:y2="http://www.suse.com/1.0/yast2ns" xmlns:config="http://www.suse.com/1.0/configns" xmlns="http://www.suse.com/1.0/yast2ns" version="1.0"> <xsl:output method="xml" encoding="UTF-8" indent="yes" omit-xml-declaration="no" cdata-section-elements="source"/> <!-- the parameter names --> <xsl:param name="hostname"/> <xsl:param name="domain"/> <xsl:template match="/"> <xsl:apply-templates select="@*|node()"/> </xsl:template> <xsl:template match="y2:dns"> <xsl:copy> <!-- where to copy the parameters --> <domain><xsl:value-of select="string($domain)"/></domain> <hostname><xsl:value-of select="string($hostname)"/></hostname> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> <xsl:template match="@*|node()" > <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> </xsl:stylesheet>
This file expects the host name and the domain name as parameters from the user.
<xsl:param name="hostname"/> <xsl:param name="domain"/>
There will be a copy of those parameters in the DNS section of the control file. This means that if there already is a domain element in the DNS section, you will get a second one, which will cause conflicts.
For more information about XSLT, go to the official Web page www.w3.org/TR/xslt