Role - kubeinit_libvirt

Role Documentation

Please, refer to the kubeinit_libvirt role official docs for further information.

Role Defaults

This section highlights all of the defaults and variables set within the “kubeinit_libvirt” role.

# All variables intended for modification should be placed in this file.

# All variables within this role should have a prefix of "kubeinit_libvirt_"
kubeinit_libvirt_debug: '{{ (ansible_verbosity | int) >= 2 | bool }}'
kubeinit_libvirt_hide_sensitive_logs: true

kubeinit_libvirt_reboot_guests_after_package_update: false

kubeinit_libvirt_target_image_dir: /var/lib/libvirt/images

kubeinit_libvirt_create_cloud_user: false
kubeinit_libvirt_cloud_user: toor
kubeinit_libvirt_source_keystore_dir: /home/{{ kubeinit_libvirt_cloud_user }}/.ssh
kubeinit_libvirt_source_pubkey_file: id_rsa.pub
kubeinit_libvirt_vms_default_password: asdfasdf

kubeinit_libvirt_centos_release: 20210603.0
kubeinit_libvirt_fcos_release: 33.20210217.3.0
kubeinit_libvirt_rhcos_release: 4.7.13
kubeinit_libvirt_ubuntu_release: "{{ 'focal' if (kubeinit_inventory_cluster_distro\
  \ == 'cdk') else 'groovy' }}"
kubeinit_libvirt_debian_release: '11'
kubeinit_libvirt_debian_codename: "{{ 'bullseye' if (kubeinit_libvirt_debian_release\
  \ == '11') }}"

kubeinit_libvirt_rhcos_release_major_minor: "{{ kubeinit_libvirt_rhcos_release.split('.')[0]\
  \ }}.{{ kubeinit_libvirt_rhcos_release.split('.')[1] }}"

kubeinit_libvirt_source_images:
  ubuntu:
    uri: https://cloud-images.ubuntu.com/{{ kubeinit_libvirt_ubuntu_release }}/current/
    iso: ''
    image: '{{ kubeinit_libvirt_ubuntu_release }}-server-cloudimg-amd64.img'
    kernel: ''
    initrd: ''
    raw: ''
    sig: ''
    rootfs: ''
  debian:
    uri: https://cloud.debian.org/images/cloud/{{ kubeinit_libvirt_debian_codename
      }}/daily/latest/
    iso: ''
    image: debian-{{ kubeinit_libvirt_debian_release }}-genericcloud-amd64-daily.qcow2
    kernel: ''
    initrd: ''
    raw: ''
    sig: ''
    rootfs: ''
  centos:
    uri: https://cloud.centos.org/centos/8-stream/x86_64/images/
    iso: ''
    image: CentOS-Stream-GenericCloud-8-{{ kubeinit_libvirt_centos_release }}.x86_64.qcow2
    kernel: ''
    initrd: ''
    raw: ''
    sig: ''
    rootfs: ''
  coreos:
    uri: https://builds.coreos.fedoraproject.org/prod/streams/stable/builds/{{ kubeinit_libvirt_fcos_release
      }}/x86_64/
    iso: ''
    image: ''
    kernel: fedora-coreos-{{ kubeinit_libvirt_fcos_release }}-live-kernel-x86_64
    initrd: fedora-coreos-{{ kubeinit_libvirt_fcos_release }}-live-initramfs.x86_64.img
    raw: fedora-coreos-{{ kubeinit_libvirt_fcos_release }}-metal.x86_64.raw.xz
    sig: fedora-coreos-{{ kubeinit_libvirt_fcos_release }}-metal.x86_64.raw.xz.sig
    rootfs: fedora-coreos-{{ kubeinit_libvirt_fcos_release }}-live-rootfs.x86_64.img
  rhcos:
    uri: https://mirror.openshift.com/pub/openshift-v4/dependencies/rhcos/{{ kubeinit_libvirt_rhcos_release_major_minor
      }}/{{ kubeinit_libvirt_rhcos_release }}/
    iso: ''
    image: ''
    kernel: rhcos-{{ kubeinit_libvirt_rhcos_release }}-x86_64-live-kernel-x86_64
    initrd: rhcos-{{ kubeinit_libvirt_rhcos_release }}-x86_64-live-initramfs.x86_64.img
    raw: rhcos-{{ kubeinit_libvirt_rhcos_release }}-x86_64-metal.x86_64.raw.gz
    sig: ''
    rootfs: rhcos-{{ kubeinit_libvirt_rhcos_release }}-x86_64-live-rootfs.x86_64.img

kubeinit_libvirt_destroy_all_guests: false

kubeinit_libvirt_hypervisor_tmp_dir: /tmp
kubeinit_libvirt_cluster_nets:
  # The following array is built with variables from the inventory
  # kimgtnet0:KubeInitManaGemenTNETwork0
- {name: '{{ kubeinit_inventory_network_name }}', net: '{{ kubeinit_inventory_network_net}}',
  cidr: '{{ kubeinit_inventory_network_cidr }}', gateway: '{{ kubeinit_inventory_network_gateway
    }}', netmask: '{{ kubeinit_inventory_network_netmask }}', start: '{{ kubeinit_inventory_network_dhcp_start
    }}', end: '{{ kubeinit_inventory_network_dhcp_end }}', template: cluster-net.xml.j2,
  type: internal, main: true, enabled: true}

kubeinit_libvirt_ovn_encapsulation: geneve
kubeinit_libvirt_ovn_switch: sw0
kubeinit_libvirt_ovn_northbound_port: 6641
kubeinit_libvirt_ovn_southbound_port: 6642

kubeinit_libvirt_hypervisor_dependencies:
  centos:
  - libguestfs-tools-c
  - python3-libselinux
  - libvirt
  - libvirt-daemon
  - libvirt-daemon-kvm
  - libvirt-client
  - qemu-kvm
  - virt-install
  - virt-top
  - virt-viewer
  - libguestfs-tools
  - lvm2
  - python3-libvirt
  - python3-lxml
  - python3-netaddr
  - curl
  - binutils
  - qt5-qtbase
  - gcc
  - make
  - patch
  - libgomp
  - glibc-headers
  - glibc-devel
  - kernel-headers
  - kernel-devel
  - bash-completion
  - nano
  - wget
  - python3-pip
  - iptables-services
  - net-tools
  - xz
  - firewalld
  - perl-XML-XPath
  debian:
  - sudo
  - numad
  - qemu
  - qemu-kvm
  - qemu-system
  - libvirt-clients
  - libvirt-daemon-system
  - libvirt-daemon
  - virt-manager
  - virt-top
  - bridge-utils
  - libguestfs-tools
  - genisoimage
  - virtinst
  - libosinfo-bin
  - python3
  - python3-pip
  - python3-libvirt
  - python3-lxml
  - python3-netaddr
  - nano
  - wget
  - xz-utils
  - inetutils-ping
  - libxml-xpath-perl
  - jq

kubeinit_libvirt_multicluster_keep_predefined_networks: false
kubeinit_libvirt_destroy_nets: true

Molecule Scenarios

Molecule is being used to test the “kubeinit_libvirt” role. The following section highlights the drivers in service and provides an example playbook showing how the role is leveraged.

Scenario: default

Driver: docker
Example default playbook
- name: Converge
  hosts: all
  # roles:
  #   - role: "kubeinit_libvirt"
  tasks:
  - name: Message for "kubeinit_libvirt"
    ansible.builtin.debug:
      msg: Finishing molecule for "kubeinit_libvirt"