Skip to content

Virtual Machine deploy operation

Virtual Machine deploy operation

CentOS infra KVM hosts

If the KVM virtual machine we want to deploy is hosted on a CentOS KVM host and hosted within the Community Cage (Red Hat) DC, same thing as for bare-metal host : add it in the Internal Inventory, and start also "reserving" IP address[es] for Operating System.

Then add the new node to /host_vars/ and also in the /kvm file/group (for inheritance).

Ensure that all the variables explained in adhoc-deploy-kvm-guest playbook are set correctly.

Note

We can deploy both CentOS and RHEL so if you define rhel_version it will be deploying RHEL but otherwise it will default to CentOS and kvm_guest_distro_release, which is normally 8-stream for now

Then you can call it like that :

 ansible-playbook playbooks/adhoc-deploy-kvm-guest.yml 
[WARNING] KVM guests to be deployed with CentOS => : <kvm_guest[s]>

The process will go like this :

  • ansible will generate a kickstart locally on the kvm host
  • will deploy a wrapper template/script (calling virt-install) with correct settings
  • call that script to kick that virt-install script that will inject the kickstart into initrd on demand
  • wait for sshd to be available on the node
  • clean-up the virt-install wrapper script for the kvm guest

Tip

As now in the ansible inventory we know where the VM is hosted, in case you need to reset a node you can use the adhoc-reset-vm.yml that will destroy the VM (through delegate_to: ansible task) and restart it

Cloud providers
AWS/EC2