Uyuni enables system administrators to build containers, systems, and virtual images. Uyuni helps with creating Image Stores and managing Image Profiles.
Uyuni supports two distinct build types:
Dockerfile-for more information, see Section 8.2, “Container Images”
Kiwi image system-for more information, see Section 8.3, “OS Images”
The containers feature is available for Salt minions running SUSE Linux Enterprise Server 12 or later. Before you begin, ensure your environment meets these requirements:
An existing external GitHub or internal GitLab repository containing a Dockerfile and configuration scripts (example scripts are provided in this chapter).
A properly configured image registry.
If you require a private image registry you can use an open source solution such as Portus.
For additional information on setting up Portus as a registry provider, see the Portus Documentation.
For more information on Containers or CaaS Platform, see:
To build images with Uyuni, you will need to create and configure a build host. Build hosts are Salt minions running SUSE Linux Enterprise 12 or later. This section guides you though the initial configuration for a build host.
From the Uyuni Web UI perform these steps to configure a build host.
Select a minion to be designated as a build host from the › page.
From the System Details page for the selected minion assign the containers modules by going to › and enabling SLE-Module-Containers12-Pool and SLE-Module-Containers12-Updates. Confirm by clicking .
From the › page, enable Add-on System Type and Container Build Host and confirm by clicking .
Install all required packages by applying Highstate. From the system details page select › and click Apply Highstate.
Alternatively, apply Highstate from the Uyuni Server command line:
salt '$your_minion' state.highstate
Create an activation key associated with the channel that your images will use.
To build containers, you will need an activation key that is associated with a channel other than "SUSE Manager Default".
Select › › .
Click .
Enter a Description and a Key name. Use the drop-down menu to select the Base Channel to associate with this key.
Confirm with .
For more information, see Chapter 7, Activation Key Management.
Define a location to store all of your images by creating an Image Store.
Select › › .
Click Create to create a new store.
Uyuni currently provides support only for the Registry store type. Define a name for the image store in the Label field.
Provide the path to your image registry by filling in the URI field, as a fully qualified domain name (FQDN) for the container registry host (whether internal or external).
registry.example.com
The Registry URI can also be used to specify an image store on a used registry.
registry.example.com:5000/myregistry/myproject
Click to add the new image store.
Manage Image Profiles from the Image Profile page.
To create an image profile select › and click .
Provide a name for the image profile by filling in the field.
Only lowercase characters are permitted in container labels.
If your container image tag is in a format such as myproject/myimage, make sure your image store registry URI contains the /myproject suffix.
Use a Dockerfile as the Image Type
Use the drop-down menu to select your registry from the Target Image Store field.
Enter a Github or Gitlab repository URL (http, https, or token authentication) in the Path field using one of the following formats:
Github single user project repository
https://github.com/USER/project.git#branchname:folder
Github organization project repository
https://github.com/ORG/project.git#branchname:folder
Github token authentication:
If your git repository is private and not publicly accessible, you need to modify the profile’s git URL to include authentication. Use this URL format to authenticate with a Github token:
https://USER:<AUTHENTICATION_TOKEN>@github.com/USER/project.git#master:/container/
Gitlab single user project repository
https://gitlab.example.com/USER/project.git#master:/container/
Gitlab groups project repository
https://gitlab.example.com/GROUP/project.git#master:/container/
Gitlab token authentication If your git repository is private and not publicly accessible, you need to modify the profile’s git URL to include authentication. Use this URL format to authenticate with a Gitlab token:
https://gitlab-ci-token:<AUTHENTICATION_TOKEN>@gitlab.example.com/USER/project.git#master:/container/
If a branch is not specified, the master branch will be used by default.
If a folder is not specified the image sources (Dockerfile sources) are expected to be in the root directory of the Github or Gitlab checkout.
Select an Activation Key. Activation Keys ensure that images using a profile are assigned to the correct channel and packages.
When you associate an activation key with an image profile you are ensuring any image using the profile will use the correct software channel and any packages in the channel.
Click the button.
This section contains an example Dockerfile. You specify a Dockerfile that will be used during image building when creating an image profile. A Dockerfile and any associated scripts should be stored within an internal or external Github or Gitlab repository:
The Dockerfile provides access to a specific repository version served by Uyuni.
This example Dockerfile is used by Uyuni to trigger a build job on a build host minion.
The ARG parameters ensure that the image that is built is associated with the desired repository version served by Uyuni.
The ARG parameters also allow you to build image versions of SUSE Linux Enterprise Server which may differ from the version of SUSE Linux Enterprise Server used by the build host itself.
For example: The ARG repo parameter and the echo command pointing to the repository file, creates and then injects the correct path into the repository file for the desired channel version.
The repository version is determined by the activation key that you assigned to your image profile.
FROM registry.example.com/sles12sp2
MAINTAINER Tux Administrator "tux@example.com"
### Begin: These lines Required for use with {productname}
ARG repo
ARG cert
# Add the correct certificate
RUN echo "$cert" > /etc/pki/trust/anchors/RHN-ORG-TRUSTED-SSL-CERT.pem
# Update certificate trust store
RUN update-ca-certificates
# Add the repository path to the image
RUN echo "$repo" > /etc/zypp/repos.d/susemanager:dockerbuild.repo
### End: These lines required for use with {productname}
# Add the package script
ADD add_packages.sh /root/add_packages.sh
# Run the package script
RUN /root/add_packages.sh
# After building remove the repository path from image
RUN rm -f /etc/zypp/repos.d/susemanager:dockerbuild.repoThis is an example add_packages.sh script for use with your Dockerfile:
#!/bin/bash set -e zypper --non-interactive --gpg-auto-import-keys ref zypper --non-interactive in python python-xml aaa_base aaa_base-extras net-tools timezone vim less sudo tar
To inspect images and provide the package and product list of a container to the Uyuni Web UI you will need to install python and python-xml within the container. If these packages remain uninstalled, your images will still build, but the package and product list will be unavailable from the Web UI.
There are two ways to build an image. You can select › from the left navigation bar, or click the build icon in the › list.
For this example select › .
Add a different tag name if you want a version other than the default latest (only relevant to containers).
Select Build Profile and Build Host.
Notice the Profile Summary to the right of the build fields.
When you have selected a build profile, detailed information about the selected profile will be displayed in this area.
To schedule a build click the button.
You can import and inspect arbitrary images.
Select › from the left navigation bar.
Complete the text boxes of the Import dialog.
Once it has processed, the imported image will be listed on the Images page.
From › click to open the Import Image dialog.
In the Import Image dialog complete these fields:
The registry from where the image will be pulled for inspection.
The name of the image in the registry.
The version of the image in the registry.
The build host that will pull and inspect the image.
The activation key that provides the path to the software channel that the image will be inspected with.
For confirmation, click .
The entry for the image is created in the database, and an Inspect Image action on Uyuni is scheduled.
Once it has been processed, you can find the imported image in the Images list.
It has a different icon in the Build column, to indicate that the image is imported (see screenshot).
The status icon for the imported image can also be seen on the Overview tab for the image.
These are some known problems that you might encounter when working with images:
HTTPS certificates to access the registry or the git repositories should be deployed to the minion by a custom state file.
SSH git access using Docker is currently unsupported. You may test it, but SUSE will not provide support.
If the python and python-xml packages are not installed in your images during the build process, Salt cannot run within the container and reporting of installed packages or products will fail.
This will result in an unknown update status.
OS images are built by the Kiwi image system. They can be of various types: PXE, QCOW2, LiveCD images, and others.
For more information about the Kiwi build system, see the Kiwi documentation.
OS image building is disabled by default. You can enable it in /etc/rhn/rhn.conf by setting:
java.kiwi_os_image_building_enabled = true
Restart the Spacewalk service to pick up the changes:
spacewalk-service restart
The Kiwi image building feature is available for Salt minions running SUSE Linux Enterprise Server 12 or later.
Kiwi image configuration files and configuration scripts must be accessible in one of these locations:
Git repository
HTTP hosted tarball
Local build host directory
Example scripts are provided in the following sections.
To build all kinds of images with Uyuni, create and configure a build host. Build hosts are Salt minions running SUSE Linux Enterprise Server 12 or later. This procedure will guide you though the initial configuration for a build host.
From the Uyuni Web UI perform these steps to configure a build host:
Select a minion that will be designated as a build host from the › › page.
From the › page, enable the Add-on System Type: OS Image Build Host and confirm with .
From the › › page, enable SLE-Manager-Tools12-Pool and SLE-Manager-Tools12-Updates (or a later version).
Schedule and click .
Install Kiwi and all required packages by applying Highstate. From the system details page select › and click . Alternatively, apply Highstate from the Uyuni Server command line:
salt '$your_minion' state.highstate
Uyuni Web Server Public Certificate RPM. Build host provisioning copies the Uyuni certificate RPM to the build host. This certificate is used for accessing repositories provided by Uyuni.
The certificate is packaged in RPM by the mgr-package-rpm-certificate-osimage package script.
The package script is called automatically during a new Uyuni installation.
When you upgrade the spacewalk-certs-tools package, the upgrade scenario will call the package script using the default values.
However if the certificate path was changed or unavailable, you will need to call the package script manually using --ca-cert-full-path <path_to_certificate> after the upgrade procedure has finished.
Package script call example.
/usr/sbin/mgr-package-rpm-certificate-osimage --ca-cert-full-path /root/ssl-build/RHN-ORG-TRUSTED-SSL-CERT
The RPM package with the certificate is stored in a salt-accessible directory such as /usr/share/susemanager/salt/images/rhn-org-trusted-ssl-cert-osimage-1.0-1.noarch.rpm.
The RPM package with the certificate is provided in the local build host repository /var/lib/Kiwi/repo.
Make sure your build source Kiwi configuration contains rhn-org-trusted-ssl-cert-osimage as a required package in the bootstrap section.
config.xml.
...
<packages type="bootstrap">
...
<package name="rhn-org-trusted-ssl-cert-osimage" bootinclude="true"/>
</packages>
...
Create an activation key associated with the channel that your images will use. Activation keys are mandatory for OS Image building.
To build OS Images, you will need an activation key that is associated with a channel other than "SUSE Manager Default".
In the Web UI, select › › .
Click Create Key.
Enter a Description, a Key name, and use the drop-down box to select a Base Channel to associate with the key.
Confirm with .
For more information, see Chapter 7, Activation Key Management.
OS images can require a significant amount of storage space.
Therefore, we recommended that the OS image store is located on a partition of its own or on a btrfs subvolume, separate from the root partition.
By default, the image store will be located at /srv/www/os-images.
Image stores for Kiwi build type, used to build system, virtual and other images, are not supported yet.
Images are always stored in /srv/www/os-images/<organization id> and are accessible via HTTP/HTTPS https://<susemanager_host>/os-images/<organization id>
Manage Image Profiles using the Web UI.
To create an image profile select from › › › and click .
In the Label field, provide a name for the Image Profile.
Use Kiwi as the Image Type.
Image store is automatically selected.
Enter a Config URL to the directory containing the Kiwi configuration files:
Git URI
HTTPS tarball
Path to build host local directory
Select an Activation Key. Activation keys ensure that images using a profile are assigned to the correct channel and packages.
When you associate an activation key with an image profile you are ensuring any image using the profile will use the correct software channel and any packages in the channel.
Confirm with the button.
Git/HTTP(S) URL to the repository
URL to the Git repository containing the sources of the image to be built. Depending on the layout of the repository the URL can be:
https://github.com/SUSE/manager-build-profiles
You can specify a branch after the # character in the URL.
In this example, we use the master branch:
https://github.com/SUSE/manager-build-profiles#master
You can specify a directory that contains the image sources after the : character.
In this example, we use OSImage/POS_Image-JeOS6:
https://github.com/SUSE/manager-build-profiles#master:OSImage/POS_Image-JeOS6
HTTP(S) URL to the tarball
URL to the tar archive, compressed or uncompressed, hosted on the webserver.
https://myimagesourceserver.example.org/MyKiwiImage.tar.gz
Path to the directory on the build host
Enter the path to the directory with the Kiwi build system sources. This directory must be present on the selected build host.
/var/lib/Kiwi/MyKiwiImage
Kiwi sources consist at least of config.xml.
Usually config.sh and images.sh are present as well.
Sources can also contain files to be installed in the final image under the root subdirectory.
For information about the Kiwi build system, see the Kiwi documentation.
SUSE provides examples of fully functional image sources at the SUSE/manager-build-profiles public GitHub repository.
Example of JeOS config.xml.
<?xml version="1.0" encoding="utf-8"?>
<image schemaversion="6.1" name="POS_Image_JeOS6">
<description type="system">
<author>Admin User</author>
<contact>noemail@example.com</contact>
<specification>SUSE Linux Enterprise 12 SP3 JeOS</specification>
</description>
<preferences>
<version>6.0.0</version>
<packagemanager>zypper</packagemanager>
<bootsplash-theme>SLE</bootsplash-theme>
<bootloader-theme>SLE</bootloader-theme>
<locale>en_US</locale>
<keytable>us.map.gz</keytable>
<timezone>Europe/Berlin</timezone>
<hwclock>utc</hwclock>
<rpm-excludedocs>true</rpm-excludedocs>
<type boot="saltboot/suse-SLES12" bootloader="grub2" checkprebuilt="true" compressed="false" filesystem="ext3" fsmountoptions="acl" fsnocheck="true" image="pxe" kernelcmdline="quiet"></type>
</preferences>
<!-- CUSTOM REPOSITORY
<repository type="rpm-dir">
<source path="this://repo"/>
</repository>
-->
<packages type="image">
<package name="patterns-sles-Minimal"/>
<package name="aaa_base-extras"/> <!-- wouldn't be SUSE without that ;-) -->
<package name="kernel-default"/>
<package name="salt-minion"/>
...
</packages>
<packages type="bootstrap">
...
<package name="sles-release"/>
<!-- this certificate package is required to access {productname} repositories
and is provided by {productname} automatically -->
<package name="rhn-org-trusted-ssl-cert-osimage" bootinclude="true"/>
</packages>
<packages type="delete">
<package name="mtools"/>
<package name="initviocons"/>
...
</packages>
</image>
There are two ways to build an image using the Web UI. Either select › › , or click the build icon in the › › list.
Select › › .
Add a different tag name if you want a version other than the default latest (applies only to containers).
Select the Image Profile and a Build Host.
A Profile Summary is displayed to the right of the build fields.
When you have selected a build profile detailed information about the selected profile will show up in this area.
To schedule a build, click the button.
After the image is successfully built, the inspection phase begins. During the inspection phase SUSE Manager collects information about the image:
List of packages installed in the image
Checksum of the image
Image type and other image details
If the built image type is PXE, a Salt pillar will also be generated.
Image pillars are stored in the /srv/susemanager/pillar_data/images/ directory and the Salt subsystem can access details about the generated image.
Details include where the pillar is located and provided, image checksums, information needed for network boot, and more.
The generated pillar is available to all connected minions.
Building an image requires of several dependent steps. When the build fails, investigation of salt states results can help you to identify the source of the failure. Usual checks when the build fails:
The build host can access the build sources
There is enough disk space for the image on both the build host and the Uyuni server
The activation key has the correct channels associated with it
The build sources used are valid
The RPM package with the Uyuni public certificate is up to date and available at /usr/share/susemanager/salt/images/rhn-org-trusted-ssl-cert-osimage-1.0-1.noarch.rpm.
For more on how to refresh a public certificate RPM, see Section 8.3.3, “Creating a Build Host”.
The section contains some known issues when working with images.
HTTPS certificates used to access the HTTP sources or Git repositories should be deployed to the minion by a custom state file, or configured manually.
Importing Kiwi-based images is not supported.
To list images available for building select › › . A list of all images will be displayed.
Displayed data about images includes an image Name, its Version and the build Status.
You will also see the image update status with a listing of possible patch and package updates that are available for the image.
Clicking the button on an image will provide a detailed view including an exact list of relevant patches and a list of all packages installed within the image.
The patch and the package list is only available if the inspect state after a build was successful.