Role - kubeinit_libvirt

Role Documentation

Welcome to the “kubeinit_libvirt” role documentation.

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_target_image_dir: /var/lib/libvirt/images
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_source_images:
  ubuntu:
    uri: https://cloud-images.ubuntu.com/focal/current/
    iso: ''
    image: focal-server-cloudimg-amd64.img
    kernel: ''
    initrd: ''
    raw: ''
    sig: ''
  centos:
    uri: https://cloud.centos.org/centos/8/x86_64/images/
    iso: ''
    image: CentOS-8-GenericCloud-8.2.2004-20200611.2.x86_64.qcow2
    kernel: ''
    initrd: ''
    raw: ''
    sig: ''
  coreos:
    uri: https://builds.coreos.fedoraproject.org/prod/streams/stable/builds/32.20200629.3.0/x86_64/
    iso: ''
    image: ''
    kernel: fedora-coreos-32.20200629.3.0-live-kernel-x86_64
    initrd: fedora-coreos-32.20200629.3.0-live-initramfs.x86_64.img
    raw: fedora-coreos-32.20200629.3.0-metal.x86_64.raw.xz
    sig: fedora-coreos-32.20200629.3.0-metal.x86_64.raw.xz.sig

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
  - python-pip
  - python-libvirt
  - python-lxml
  - nano
  - wget
  - xz-utils
  - inetutils-ping
  - libxml-xpath-perl

kubeinit_libvirt_hypervisor_tmp_dir: /tmp
kubeinit_libvirt_destroy_nets: true
kubeinit_libvirt_cluster_nets:
  # The following array is built with variables from the inventory
  # kimgtnet0:KubeInitManaGemenTNETwork0 kimgtbr0: KubeInitManaGemenTBRidge0
- {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 }}', bridge: '{{ kubeinit_inventory_network_bridge
    }}', template: cluster-net.xml.j2, type: internal, main: true, enabled: true}

# EXTERNAL NETWORK CONFIG
kubeinit_libvirt_external_service_interface_enabled: false
kubeinit_libvirt_external_service_interface:
  # This will attach the eth1 interfate to the bridge kiextbr0
  # you MUST have the kiextbr0 bridge created and with the
  # physical connection slaved first
  attached: '{{ kubeinit_inventory_network_bridge_external }}'
  dev: '{{ kubeinit_inventory_network_bridge_external_dev }}'
  ip: '{{ kubeinit_inventory_network_bridge_external_ip }}'
  gateway: '{{ kubeinit_inventory_network_bridge_external_gateway }}'
  netmask: '{{ kubeinit_inventory_network_bridge_external_netmask }}'
  mac: '{{ kubeinit_inventory_network_bridge_external_mac }}'

kubeinit_libvirt_dns_forward_multicluster_enabled: false
# Required for forwarding the DNS queries to the specific service
# machines in all the networks we create.
kubeinit_libvirt_dns_forward_multicluster_inventory_files:
- ../../../hosts/rke/inventory
- ../../../hosts/okd/inventory

Role Variables: main.yml

null
...

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"
    debug:
      msg: Finishing molecule for "kubeinit_libvirt"