Generating the host inventory

Generate the inventory that lists every host and assigns it to the Kubernetes groups, using the helper in the LCM image.

The inventory lists every host and assigns it to the Kubernetes groups. You can write it by hand or generate it with the helper in the LCM image.

  • The LCM image is on the LCM host.
  • You know the host names and management addresses.
  1. Run the inventory helper, naming the control plane hosts and the compute hosts. Give an address explicitly as NAME=ADDRESS. A bare name is resolved from the hosts file, which is why the command mounts that file into the container.
    sudo podman run --rm \
      -v /srv/ccc-lcm:/opt/ccc-lcm \
      -v /etc/hosts:/etc/hosts:ro \
      --entrypoint prepare-inventory.py \
      <registry-host>/ccc/cloudera/ccc-lcm:<lcm-tag> \
      generate \
      --control host-1 host-2 host-3 \
      --compute host-4=<address-4> host-5=<address-5> host-6=<address-6> \
      --output /opt/ccc-lcm/configs/inventory.ini
  2. Review the generated file at /srv/ccc-lcm/configs/inventory.ini. A generated inventory has the following form.
    [all]
    host-1 ansible_host=192.0.2.11 ip=192.0.2.11
    host-2 ansible_host=192.0.2.12 ip=192.0.2.12
    host-3 ansible_host=192.0.2.13 ip=192.0.2.13
    host-4 ansible_host=192.0.2.21 ip=192.0.2.21
    host-5 ansible_host=192.0.2.22 ip=192.0.2.22
    host-6 ansible_host=192.0.2.23 ip=192.0.2.23
    
    [kube_control_plane]
    host-1
    host-2
    host-3
    
    [etcd]
    host-1
    host-2
    host-3
    
    [kube_node]
    host-1
    host-2
    host-3
    host-4
    host-5
    host-6

The inventory file exists. To refresh the addresses in an existing inventory later, replace the generate arguments with update /opt/ccc-lcm/configs/inventory.ini. The helper keeps the previous file with a .bak suffix.