Guided Exercise: Create a blueprint and image

Create a blueprint and its corresponding image by using the web console.

Outcomes

  • Create a blueprint and the corresponding image by using the web console.

    1. Install osbuild-composer, composer-cli, cockpit-composer, bash-completion and their dependencies on workstation.

    2. Create a blueprint called composer-test on the workstation machine.

    3. Add the bison package to the composer-test blueprint.

    4. Create a tar image using the composer-test blueprint.

As the student user on the workstation machine, use the lab command to prepare your environment for this exercise, and to ensure that all required resources are available.

[student@workstation ~]$ lab start imagebuilder-create
Note: Image builder usually requires a subscription to work.
The lab start script configures this lab in a way that you do not need a subscription (uses local dvd repos).
In your own systems, you need to subscribe them to use image builder.
For information on this workaround you can refer https://bugzilla.redhat.com/show_bug.cgi?Bugzilla_restrictlogin=on&id=1915351[RFE: be able to use composer without CDN connection]

Instructions

The lab start script installed the osbuild-composer, composer-cli, cockpit-composer, bash-completion packages and their dependencies on workstation.lab.example.com.

  1. Start and enable image builder and cockpit sockets.

    [student@workstation ~]$ sudo systemctl enable --now osbuild-composer.socket
    Created symlink /etc/systemd/system/sockets.target.wants/osbuild-composer.socket → /usr/lib/systemd/system/osbuild-composer.socket.
    [student@workstation ~]$ sudo systemctl enable --now cockpit.socket
    Created symlink /etc/systemd/system/sockets.target.wants/cockpit.socket → /usr/lib/systemd/system/cockpit.socket.
  2. Load the shell configuration script so that the autocomplete feature for the composer-cli command starts working immediately without reboot.

    [student@workstation ~]$ source /etc/bash_completion.d/composer-cli
  3. To run the composer-cli commands as a non-root user, the user must be in the weld or the root group.

    1. To add the student user to the weldr or the root group, run the following commands.

      1. Enter the sudo password student when prompted. [student@workstation ~]$ sudo usermod -a -G weldr student [student@workstation ~]$ newgrp weldr

    2. Check the sources configured for image builder.

      [student@workstation ~]$ composer-cli sources list
      appstream
      baseos
      [student@workstation ~]$ composer-cli sources info baseos
      check_gpg = false
      check_repogpg = false
      check_ssl = true
      gpgkeys = [...output omitted...]
      id = "baseos"
      name = "baseos"
      rhsm = false
      system = true
      type = "yum-baseurl"
      url = "http://content.example.com/rhel9.0/x86_64/dvd/BaseOS"
      [student@workstation ~]$ composer-cli sources info appstream
      ...output omitted...
      1. Notice the url field, it points to the dvd repo. In your own (external to this lab) system, after you subscribe the system and configure image builder, you see the url of Red Hat CDN.

  4. Access the image builder dashboard in the RHEL web console.

    1. Visit the GNOME login screen on the workstation system. You can access the console under the Lab Environment tab of this ROLE course and then by clicking the Open Console button beside the workstation machine.

    2. After the GNOME login screen is visible, click the student user account. Enter student when prompted for the password.

    3. Navigate to https://localhost:9090/ in the Firefox browser on the workstation system to open the RHEL web console.

      4.3
    4. Proceed with the self-signed certificate by clicking on Advanced…​ and Accept the Risk and Continue.

      4.4
    5. The login page of the RHEL web console is now visible. Log in by using the username student and by entering the student password.

      4.5
    6. Click Turn on administrative access. Enter the password student when prompted and click Authenticate.

      4.6.1
    4.6.2
    1. Now you have administrative access on the workstation host.

  5. Click Image Builder in the left sidebar and then click Create blueprint.

    5
  6. For the new blueprint name, use composer-test. The description is optional, but you can type something in that field, as shown here. After entering details click Next.

    6
  7. Add the bison package to the composer-test blueprint.

    1. With the new blueprint open, under Available packages, type bison in the filter by name box and press enter. Confirm the results are similar to what is shown here.

      1. It can take about 2-3 minutes for the search to complete.

        7.1
    2. Select the bison package from the search result.

      7.2
    3. Click > to add the selected bison package to Chosen packages.

      7.3
    4. Click Next to proceed.

      7.4
    5. Keep clicking Next until it reaches the Review section and then click Save.

      7.5.1
      1. Alternatively, you can reduce the font size in the browser to see the options sidebar. Click Review to directly jump to the review section.

        7.5.2
  8. Create a tar image using the composer-test blueprint.

    1. With the composer-test blueprint still open, click Create image.

      8.1
    2. In the Create image dialog, select Disk Archive (`.tar) as the Image output type and click Next to proceed.

      8.2
    3. In Review section, click Create.

      8.3
    4. Verify that the image creation is added to queue. Click the Images tab to see the status.

      8.4
    5. On the Images tab, verify the image output Type and image Status.

      8.5
      Note:
       Wait for the image to be created before continuing. This might take about 5 minutes to complete. To verify the status from a command line, switch to the terminal to the workstation machine and run composer-cli compose list command repeatedly:
      [student@workstation ~]$ composer-cli compose list
      ID                                     Status    Blueprint       Version   Type
      838abcf7-a455-4388-b51e-0fea3d406786   RUNNING   composer-test   0.0.0     tar
      [student@workstation ~]$ composer-cli compose list
      ID                                     Status     Blueprint       Version   Type
      838abcf7-a455-4388-b51e-0fea3d406786   FINISHED   composer-test   0.0.0     tar
      Verify that the status column changes from RUNNING to FINISHED.
    6. Switch to the browser and refresh the web page.

      1. Click the Images tab to verify that the image status is Ready.

        8.6
  9. Run the grading script to verify your work,

    [student@workstation ~]$ lab grade imagebuilder-create
     Grading lab.
     SUCCESS Checking lab systems
     ...output omitted...
     Overall lab grade: PASS
    1. Do not delete the composer-test blueprint because you use it in a later exercise.