The purpose of this exercise is to review how RHDE is updated, and then automate this process. Once finished, you should be able to run a job template in Ansible Controller, specify the version of an image you’d like, and then let Ansible handle the rest.
Note
This exercise is reused at a few different times throughout the workshop, so if you’ve already completed some of these steps, jump to step 4.
Red Hat Device Edge is rpm-ostree based, and so upgrades are handled differently than traditional Red Hat Enterprise Linux.
The rpm-ostree status
command will print out information about the running image. On this system, a newer image is deployed and available, but it isn’t the current running instance, as denoted by the star in front of the image labeled Version: 1.0.0
.
[root@Colossus ~]# rpm-ostree status
State: idle
Deployments:
rhel:rhel/8/x86_64/edge
Version: 2.0.0 (2023-01-20T13:34:53Z)
Diff: 5 added
* rhel:rhel/8/x86_64/edge
Version: 1.0.0 (2023-01-19T18:51:54Z)
To manually upgrade a device, run the rpm-ostree upgrade
command:
[root@Colossus ~]# rpm-ostree upgrade
⠤ Writing objects: 1
Writing objects: 1... done
Staging deployment... done
Added:
libev-4.24-6.el8.x86_64
libuv-1:1.41.1-1.el8_4.x86_64
libwebsockets-4.0.1-2.el8.x86_64
mosquitto-1.6.15-1.el8.x86_64
nodejs-1:16.18.1-3.module+el8.7.0+17465+1a1abd74.x86_64
Run "systemctl reboot" to start a reboot
Then reboot the device to boot into the newly deployed image.
This approach is fine for testing, however isn’t viable at scale. We’re going to automate this process.
The flow of the playbook will be as follows:
For this workshop, we’re controlling access to new image versions at the repo level, so our playbook can be more simplistic.
Return to your code repo and open your favorite editor. In the playbooks/
directory, create a new playbook called upgrade-rhde.yml
.
---
- name: upgrade RHDE
hosts:
- all
tasks:
- name: upgrade RHDE
ansible.posix.rpm_ostree_upgrade:
register: rhde_upgraded
post_tasks:
- name: reboot device
ansible.builtin.reboot:
reboot_command: systemctl reboot
reboot_timeout: 300
when:
- rhde_upgraded.changed
The ansible.posix.rpm_ostree_upgrade
command will handle checking for a new image version, and if one is available, upgrade the system.
Once you’ve finished creating playbook, commit and push it up into your code repository.
Note
Ensure you’ve synced your project before attempting to create a job template.
Now that we have a playbook available in our code reop, we can create a job template to run our playbook.
Under Resources > Templates, select Add > Add job template and enter the following information:
Parameter | Value |
---|---|
Name | Upgrade Edge Device |
Inventory | Edge Systems |
Project | Device Edge Codebase |
Execution Environment | Device Edge Workshops Execution Environment |
Playbook | playbooks/upgrade-rhde.yml |
Credentials |
|
Limit |
|
Options |
|
Remember to click Save.
Click the Launch button if the Upgrade Device Edge Job Template is already open. Otherwise, on the Templates page, click on the rocket ship to launch our newly created job template. A pop-up should appear in your browser asking for you to input the limit for the job.
Enter the name of your edge device, for example: edge-525400433c01
, then hit Next. Ensure your limit looks correct on the next screen, then hit the Launch button.
Ideally, your edge device will have upgraded and rebooted, with Ansible Controller showing changed
for the upgrade RHDE
and reboot device
tasks.
This playbook is idempotent: if the device does not see an available upgrade, nothing will happen and it will not reboot.
Job template:
Entering a limit:
Confirm Input:
Navigation
Continue to deploy on the OS | Continue to deploy containerized | Continue to deploy on MicroShift |