Installing and configuring cloud-init on RHEL

Before you capture a virtual machine, you need to install the cloud-init package. This topic provides you details about cloud-init installation procedure for RHEL.

Install cloud-init on Red Hat® Enterprise Linux®

This section details procedure for installing cloud-init on RHEL 7.x, RHEL 8.2, RHEL 8.4, RHEL 8.6, and later, and RHEL 9.x.
PowerVC supports cloud-init-19.1 for RHEL 7.x. PowerVC supports RHEL provided cloud-init for RHEL 8.2 and later. See supported versions of RHEL guest OS at Hardware and software requirements.
  • Update NetworkManager to the latest version available on the OS.

    Use yum update NetworkManager to update NetworkManager.

  • When updating existing RHEL on your system to a later version, refer to cloud-init configuration steps to reconfigure cloud-init (for ppc64le architecture only).
  • For troubleshooting steps related to MAC address conflict issues, see MAC address conflict.
  • If any of the RHEL versions (for example, RHEL 8.2) become out of support, you must obtain extended support from Red Hat. Follow the requirements of extended support and apply patches or updates as recommended by Red Hat. For more information about extended support, see RHEL Extended Update Support (EUS) Overview.
  1. Perform the following steps to configure cloud-init-19.1 packages for RHEL 7.x. For instructions to configure RHEL provided cloud-init for RHEL 8.2 and later, see step 2.
    1. Before you install cloud-init, you must install the dependencies for cloud-init from the operating system base and supplemental media, by using yum. Ensure that the dependencies are updated to the latest level. 

      Table 1. RHEL packages
      RHEL 7.x
      python(abi) = 2.7 
    2. Obtain the latest versions of cloud-init-19.1 packages for RHEL 7.x from respective location. For RHEL 7, you must install additional package dependencies before installing cloud-init packages.
    3. Run yum install download_path/<cloud-init package> to install cloud-init. Make sure you provide complete RPM path during installation.
  2. To enable cloud-init on RHEL 8.2 (cloud-init-18.5-12.el8_2.6 and above), RHEL 8.4, RHEL 8.6, and RHEL 9.x system, perform the following steps. Ensure the guest OS is updated to the latest version before installing cloud-init (RHEL 8.2 March 2021 update or above).
    1. Install the RHEL provided cloud-init.
      yum install cloud-init
    2. Add following data to /etc/cloud/cloud.cfg file. Set ssh_pwauth to false if you want to disable password authentication.
      ssh_pwauth: true
      manage_resolv_conf: false
      datasource_list: [ ConfigDrive, NoCloud, None ]
          dsmode: local

      Add resolv_conf in cloud-init module section after update_etc_hosts.

      Enable and start the cloud-init related services by running the following commands:
      systemctl enable cloud-init-local.service
      systemctl enable cloud-init.service
      systemctl enable cloud-config.service
      systemctl enable cloud-final.service
      systemctl start cloud-init.service
      systemctl start cloud-init-local.service
      systemctl start cloud-config.service
      systemctl start cloud-final.service
      Note: Ensure that the cloud.cfg file has the reset_rmc module listed. If you do not see the module listed, then make sure you update OS to the latest version of cloud-init.
      In case the reset_rmc module is missing even after OS update, make sure you add the module in cloud_final_modules section of the /etc/cloud/cloud.cfg as follows:
      - reset_rmc
    3. Create a new file /etc/cloud/ds-identify.cfg and add following data.
      policy: search,found=all,maybe=all,notfound=disabled
    4. Update the NetworkManager package to the latest provided by RHEL.
      yum upgrade NetworkManager
    5. Make sure firewall is configured correctly to open up RMC port 657 for inbound and outbound traffic.
PowerVC is responsible for only bringing up the virtual machines. You can leverage cloud-init for specific customization. An example of generating new machine ID is given here. Update the file at /etc/cloud/cloud.cfg.
  • Add:
    - rm -f /etc/machine-id
    - systemd-machine-id-setup
For details on customizing cloud-init, read cloud-init community documentation.