Installing and configuring cloud-init on SLES

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 SLES.

Install cloud-init on SLES

Notes:
  • Install dependencies are available in SLES media or SUSE cloud repositories. If you are unable to configure, contact SUSE support.
  • If you do not have access to SUSE repository, you can create your own repository from SUSE media. See Configuring cloud-init dependencies for more details.
  • For troubleshooting steps related to MAC address conflict issues, see MAC address conflict.
  1. Follow these steps to install cloud-init on SLES 12, SLES 15, and SLES 15 SP1. For instructions to configure SLES provided cloud-init for SLES 15 SP2 and later, see step 2.

    PowerVC supports cloud-init-19.1 for SLES 12 and SLES 15.

    1. Perform the following steps to configure cloud-init-19.1 for SLES 12 and SLES 15.
      1. To configure SUSE repository, run SUSEConnect -p sle-module-public-cloud/<SLES versions>/ppc64le. Before installing cloud-init, make sure the following packages are installed. Install cloud-init by running zypper install <package-name>. You can ignore any package signing related message and continue with the installation.

        Table 1. SLES packages
        SLES 12 SLES 15
        e2fsprogs 
        iproute 
        net-tools 
        policycoreutils-python 
        procps 
        python(abi) = 2.7 
        python-PrettyTable 
        python-PyYAML 
        python-configobj 
        python-jinja2 
        python-jsonpatch 
        python-jsonschema 
        python-oauthlib 
        python-requests 
        python-setuptools 
        python-six
        xfsprogs
        python3-oauthlib
        python3-Jinja2
        python3-PyYAML
        python3-distro
        python3-jsonpatch
        python3-jsonschema
        python3-PrettyTable
        python3-requests
        python3-configobj
      2. For SLES 12, obtain the RPM from PowerVC SLES 12 public repo. For SLES 15, obtain the RPM from PowerVC SLES 15 public repo.
      3. Install cloud-init by running zypper install download_path/<cloud-init package>.
  2. To enable cloud-init on SLES 15 SP2 and later systems, perform the following steps.
    1. Install SUSE provided cloud-init.
      zypper 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
      
    3. Add resolv_conf in cloud-init module section after update_etc_hosts in /etc/cloud/cloud.cfg file, if resolv_conf is not present.
    4. In case the reset_rmc module is missing, make sure that you add the module in cloud_final_modules section of the /etc/cloud/cloud.cfg file.
      reset_rmc
    5. 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
      
    6. Create a new file /etc/cloud/ds-identify.cfg and add following data.
      policy: search,found=all,maybe=all,notfound=disabled
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
    - rm -f /var/lib/dbus/machine-id 
    - /usr/bin/dbus-uuidgen --ensure 
    - systemd-machine-id-setup
For details, read cloud-init community documentation.