Ondrej Famera - top logo

Automated fast-vm deploy with Ansible

Admittively fast-vm initial installation and configuration is not the easiest one and has several places where choices can be made. However for some people this might not be interesting or some would like to just get the thing installed with some kind of "recommended configuration ready for use". So to achieve this I have created 2 Ansible roles which if combined gets all the needed setup and ready for use. In case you don't care about any settings then you will receive applying these roles:

  • fast-vm installation from repository
  • fast-vm fully configured on 50GB thinpool LV created during installation with network for VMs
  • support for UEFI VMs
  • support for fencing VMs using fence_xvm with key in /etc/cluster/fence_xvm.key
  • qemu-kvm and seabios-bin with support for MegaRAID SAS and LSI SAS controllers
  • Import of all fast-vm images from public image list

To achieve above you will need Ansible and VG that has 50GB of free space and target system should be CentOS/RHEL 7.3. With this knowledge you can use the example playbook below and get all of above done in less than hour depending on your Internet connection, HW, etc.

Example of fast-vm.yml
- hosts: servers
  remote_user: root
    - { role: 'OndrejHome.fast-vm-server', fastvm_vg: 'data_vg', tags: 'always' }
    - { role: 'OndrejHome.fast-vm-import-images' }
Example of fast-vm.hosts
Commands that will make all above to happen.
# ansible-galaxy install OndrejHome.fast-vm-server
# ansible-galaxy install OndrejHome.fast-vm-import-images
# ansible-playbook -i fast-vm.hosts fast-vm.yml
If you wish to import only some of the images to be imported then just run the ansible-playbook command with --tags argument and specify which images or group of images you want. Below is example on how to import all CentOS 7 images (normal and UEFI), Fedora 25 image and all Debian images.
# ansible-playbook -i fast-vm.hosts fast-vm.yml --tags 'centos7_all,fedora_25,debian'

That's it. In above example VG 'data_vg' is used for fast-vm thinpool LV. All other things are done by the ansible roles. Feel free to play with above and check the README files of ansible roles to learn more on what everything you can change if you want to. Link for ansible roles are below.

  • OndrejHome.fast-vm-server
  • OndrejHome.fast-vm-import-images
Last change .