Kubic:MicroOS/Ignition
Configuration of openSUSE MicroOS and openSUSE Kubic with Ignition
Contents
Ignition is supposed to create a lightweight alternative to cloud-init. For a short comparison of those two provisioning tools see Ignition vs cloud-init.
This Wiki page will contain SUSE specific information; for general Ignition documentation please refer to the current development snapshot on https://github.com/coreos/ignition/tree/master/doc.
Installation
Ignition is bundled with our pre-made Kubic & MicroOS VM images.
Use the following commands to install the current stack on other systems:
zypper in ignition-dracut
or
transactional-update pkg in ignition-dracut
For development builds see https://build.opensuse.org/project/show/devel:kubic:ignition.
Usage
Ignition configuration files
See the current Ignition documentation for creating Ignition files.
x-initrd.mount
will be mounted during the files stage of Ignition. On a openSUSE MicroOS based systems this means that /var and /etc will be available by default, but /home or /root won't be. Make sure to add the flag to all mount points in /etc/fstab where you need access to.Triggering Ignition
Premade images
On first boot the system will try to configure itself using Ignition.
Package installation
If the ignition-dracut package was installed manually, Ignition will be triggered on the next boot automatically.
The packages' post script will try to detect the current platform and set ignition.platform.id
in /etc/default/grub accordingly. If the platform could not be detected metal
is used as the default value.
Manual invocation
Ignition will be triggered if the ignition.firstboot
kernel parameter is set. This can be achieved by using one of the following methods:
- Manually add the parameter
ignition.firstboot
to the kernel command line. - Create the file /boot/writable/ignition.firstboot (which may contain further kernel parameters).
Note that Ignition also needs the ignition.platform.id
parameter to be set.
USB flash drive
In addition to the platform specific methods on openSUSE it is possible to load a so called user configuration from a USB flash drive. This is especially useful with the metal
platform, as there is no platform specific configuration mechanism there.
To use this feature:
- Format you USB flash drive with any Linux file system (e.g. EXT4)
- Set the partition label to
ignition
(lower case; for an EXT4 formatted drive with one partition, usee2label /dev/sdX1 ignition
) - Mount that partition
- Create a directory with the name ignition
- Copy the Ignition configuration to a file called config.ign within that directory.
Examples
Add password and SSH key for root user
The SSH key will be created in /root, but only /, /var and /etc are mounted by default. For that reason /root will have to be defined explicitly.
{ "ignition": { "version": "3.1.0-experimental" }, "storage": { "filesystems": [ { "path": "/root", "device": "/dev/sda3", "format": "btrfs", "wipeFilesystem": false, "mountOptions": [ "subvol=/@/root" ] } ] }, "passwd": { "users": [ { "name": "root", "passwordHash": "hash, created with e.g. `openssl passwd -6`", "sshAuthorizedKeys": [ "ssh-rsa long...key user@host" ] } ] } }