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.0, RHEL 8.1, RHEL 8.2, and RHEL 8.4.
PowerVC supports cloud-init-19.1 for RHEL 7.x and RHEL 8.0. PowerVC supports RHEL provided cloud-init for RHEL 8.1 and later. See supported versions of RHEL guest OS at Hardware and software requirements.
Notes:
  • 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 Installing and configuring cloud-init on RHEL to reconfigure cloud-init (for ppc64le architecture only).
  • For troubleshooting steps related to MAC address conflict issues, see MAC address conflict.
  • To avoid running into issues on RHEL 8.0 guest OS, review the steps in RMC inactive for RHEL 8 guest OS on NovaLink hosts.
  • If some of the RHEL versions (for example, RHEL 8.1 and 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, and RHEL 8.0. For instructions to configure RHEL provided cloud-init for RHEL 8.1 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 RHEL 8.0
      e2fsprogs 
      iproute 
      libselinux-python
      net-tools 
      policycoreutils-python 
      procps 
      python(abi) = 2.7 
      python-configobj
      python-jinja2
      python-jsonpatch  
      python-oauthlib
      python-PrettyTable 
      python-requests 
      python-six
      python-yaml
      python-jsonschema
      e2fsprogs
      iproute
      net-tools
      procps
      python(abi) = 3.6
      python3-configobj
      python3-jinja2
      python3-jsonpatch
      python3-jsonschema
      python3-libselinux
      python3-oauthlib
      python3-policycoreutils
      python3-PrettyTable
      python3-requests
      python3-six
      python3-yaml
    2. Obtain the latest versions of cloud-init-19.1 packages for RHEL 7.x and RHEL 8.0 from respective locations. 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.1 (cloud-init-18.5-7.el8_1.4 and above), RHEL 8.2 (cloud-init-18.5-12.el8_2.6 and above) and RHEL 8.4 system, perform the following steps. Ensure the guest OS is updated to the latest version before installing cloud-init (RHEL 8.1 or 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 ]
      datasource:
        ConfigDrive:
          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:
    runcmd:
    - rm -f /etc/machine-id
    - systemd-machine-id-setup
For details on customizing cloud-init, read cloud-init community documentation.