Search

Chapter 8. Using the Ignition tool for the RHEL for Edge Simplified Installer images

download PDF

RHEL for Edge uses the Ignition tool to inject the user configuration into the images at an early stage of the boot process. The user configuration that the Ignition tool injects includes:

  • The user configuration.
  • Writing files, such as regular files, and systemd units.

On the first boot, Ignition reads its configuration either from a remote URL or a file embedded in the simplified installer ISO. Then, Ignition applies that configuration into the image.

8.1. Creating an Ignition configuration file

The Butane tool is the preferred option to create an Ignition configuration file. Butane consumes a Butane Config YAML file and produces an Ignition Config in the JSON format. The JSON file is used by a system on its first boot. The Ignition Config applies the configuration in the image, such as user creation, and systemd units installation.

Prerequisites

  • You have installed the Butane tool version v0.17.0:

    $ sudo dnf/yum install -y butane

Procedure

  1. Create a Butane Config file and save it in the .bu format. You must specify the variant entry as r4e, and the version entry as 1.0.0, for RHEL for Edge images. The butane r4e variant on version 1.0.0 targets Ignition spec version 3.3.0. The following is a Butane Config YAML file example:

    variant: r4e
    version: 1.0.0
    ignition:
      config:
        merge:
          - source: http://192.168.122.1:8000/sample.ign
    passwd:
      users:
        - name: core
          groups:
            - wheel
          password_hash: password_hash_here
          ssh_authorized_keys:
            - ssh-ed25519 some-ssh-key-here
    storage:
      files:
        - path: /etc/NetworkManager/system-connections/enp1s0.nmconnection
          contents:
            inline: |
              [connection]
              id=enp1s0
              type=ethernet
              interface-name=enp1s0
              [ipv4]
              address1=192.168.122.42/24,192.168.122.1
              dns=8.8.8.8;
              dns-search=
              may-fail=false
              method=manual
          mode: 0600
        - path: /usr/local/bin/startup.sh
          contents:
            inline: |
              #!/bin/bash
              echo "Hello, World!"
          mode: 0755
    systemd:
      units:
        - name: hello.service
          contents: |
            [Unit]
            Description=A hello world
            [Install]
            WantedBy=multi-user.target
          enabled: true
        - name: fdo-client-linuxapp.service
          dropins:
            - name: log_trace.conf
              contents: |
                [Service]
                Environment=LOG_LEVEL=trace
  2. Run the following command to consume the Butane Config YAML file and generate an Ignition Config in the JSON format:

    $ ./path/butane example.bu
    {"ignition":{"config":{"merge":[{"source":"http://192.168.122.1:8000/sample.ign"}]},"timeouts":{"httpTotal":30},"version":"3.3.0"},"passwd":{"users":[{"groups":["wheel"],"name":"core","passwordHash":"password_hash_here","sshAuthorizedKeys":["ssh-ed25519 some-ssh-key-here"]}]},"storage":{"files":[{"path":"/etc/NetworkManager/system-connections/enp1s0.nmconnection","contents":{"compression":"gzip","source":"data:;base64,H4sIAAAAAAAC/0yKUcrCMBAG3/csf/ObUKQie5LShyX5SgPNNiSr0NuLgiDzNMPM8VBFtHzoQjkxtPp+ITsrGLahKYyyGtoqEYNKwfeZc32OC0lKDb179rfg/HVyPgQ3hv8w/v0WT0k7T+7D/S1Dh7S4MRU5h1XyzqvsHVRg25G4iD5kp1cAAAD//6Cvq2ihAAAA"},"mode":384},{"path":"/usr/local/bin/startup.sh","contents":{"source":"data:;base64,IyEvYmluL2Jhc2gKZWNobyAiSGVsbG8sIFdvcmxkISIK"},"mode":493}]},"systemd":{"units":[{"contents":"[Unit]\nDescription=A hello world\n[Install]\nWantedBy=multi-user.target","enabled":true,"name":"hello.service"},{"dropins":[{"contents":"[Service]\nEnvironment=LOG_LEVEL=trace\n","name":"log_trace.conf"}],"name":"fdo-client-linuxapp.service"}]}}

    After you run the Butane Config YAML file to check and generate the Ignition Config JSON file, you might get warnings when using unsupported fields, like partitions, for example. You can fix those fields and rerun the check.

You have now an Ignition JSON configuration file that you can use to customize your blueprint.

Additional resources

8.2. Creating a blueprint in the GUI with support to Ignition

When building a Simplified Installer image, you can customize your blueprint by entering the following details in the Ignition page of the blueprint:

  • Firstboot URL - You must enter a URL that points to the Ignition configuration that will be fetched during the first boot. It can be used for both the raw image and simplified installer image.
  • Embedded Data - You must provide the base64 encoded Ignition Configuration file. It can be used only for the Simplified Installer image.

To customize your blueprint for a simplified RHEL for Edge image with support to Ignition configuration using the Ignition blueprint customization, follow the steps:

Prerequisites

  • You have opened the image builder app from web console in a browser. See Accessing the image builder GUI in the RHEL web console.
  • To fully support the embedded section, coreos-installer-dracut has to be able to define -ignition-url|-ignition-file based on the presence of the OSBuild’s file.

Procedure

  1. Click Create Blueprint in the upper-right corner.

    A dialog wizard with fields for the blueprint name and description opens.

    • On the Details page:

      • Enter the name of the blueprint and, optionally, its description. Click Next.
    • On the Ignition page, complete the following steps:

      • On the Firstboot URL field, enter the URL that points to the Ignition configuration to be fetched during the first boot.
      • On the Embedded Data field, drag or upload the base64 encoded Ignition Configuration file. Click Next.
    • Review the image details and click Create.

The image builder dashboard view opens, listing the existing blueprints.

Next

8.3. Creating a blueprint with support to Ignition using the CLI

When building a simplified installer image, you can customize your blueprint by adding the customizations.ignition section to it. With that, you can create either a simplified installer image or a raw image that you can use for the bare metal platforms. The customizations.ignition customization in the blueprint enables the configuration files to be used in edge-simplified-installer ISO and edge-raw-image images.

  • For the edge-simplified-installer ISO image, you can customize the blueprint to embed an Ignition configuration file that will be included in the ISO image. For example:

    [customizations.ignition.embedded]
    config = "eyJ --- BASE64 STRING TRIMMED --- 19fQo="

    You must provide a base64 encoded Ignition configuration file.

  • For both the edge-simplified-installer ISO image and also the edge-raw-image, you can customize the blueprint, by defining a URL that will be fetched to obtain the Ignition configuration at the first boot. For example:

    [customizations.ignition.firstboot]
    url = "http://your_server/ignition_configuration.ig"

    You must enter a URL that points to the Ignition configuration that will be fetched during the first boot.

To customize your blueprint for a Simplified RHEL for Edge image with support to Ignition configuration, follow the steps:

Prerequisites

  • If using the [customizations.ignition.embedded] customization, you must create an Ignition configuration file.
  • If using the [customizations.ignition.firstboot] customization, you must have created a container whose URL points to the Ignition configuration that will be fetched during the first boot.
  • The blueprint customization [customizations.ignition.embedded] section enables coreos-installer-dracut to define -ignition-url|-ignition-file based on the presence of the osbuild’s file.

Procedure

  1. Create a plain text file in the Tom’s Obvious, Minimal Language (TOML) format, with the following content:

    name = "simplified-installer-blueprint"
    description = "Blueprint with Ignition for the simplified installer image"
    version = "0.0.1"
    packages = []
    modules = []
    groups = []
    distro = ""
    
    [customizations.ignition.embedded]
    config = "eyJ --- BASE64 STRING TRIMMED --- 19fQo="

    Where:

    • The name is the name and description is the description for your blueprint.
    • The version is the version number according to the Semantic Versioning scheme.
    • The modules and packages describe the package name and matching version glob to be installed into the image. For example, the package name = "tmux" and the matching version glob is version = "3.3a". Notice that currently there are no differences between packages and modules.
    • The groups are packages groups to be installed into the image. For example groups = "anaconda-tools" group package. If you do not know the modules and groups, leave them empty.

      Warning

      If you want to create a user with Ignition, you cannot use the FDO customizations to create a user at the same time. You can create users using Ignition and copy configuration files using FDO. But if you are creating users, create them using Ignition or FDO, but not both at the same time.

  2. Push (import) the blueprint to the image builder server:

    # composer-cli blueprints push blueprint-name.toml
  3. List the existing blueprints to check whether the created blueprint is successfully pushed and exists.

    # composer-cli blueprints show blueprint-name
  4. Check whether the components and versions listed in the blueprint and their dependencies are valid:

    # composer-cli blueprints depsolve blueprint-name

Next

Additional resources

Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.