Ansible scripts for creating VMs for quick lab using kvm. All resources are created in this directory.
= Scenario: The idea is to start a few VMs on a host (localhost) and automatically setup these VMs to form a virtual infrastructure for e.g., OpenStack.
= Steps:
Preparing virtual network using bridge, tun, tap
Provisioning VMs
Custom scripts for VMs installation
= Roles: == kvm_host_setup:
== kvm_network:
== kvm_manage:
= Design decisions:
= Usage: == Install libraries and roles ansible-galaxy install -r requirements.yml
== Start lab
=== Setup
Run all roles:
ansible-playbook -i inventory/vi_nodes quicklab_kvm_openstack.yml -vvv
Run roles with tags:
ansible-playbook -i inventory/vi_nodes quicklab_kvm_openstack.yml --tags network -vvvv
ansible-playbook -i inventory/vi_nodes quicklab_kvm_openstack.yml --tags firewall -vvvv
ansible-playbook -i inventory/vi_nodes quicklab_kvm_openstack.yml --tags dnsmasq -vvvv
Shutdown: cleanup everything.
ansible-playbook -i inventory/vi_nodes quicklab_kvm_openstack_shutdown.yml -vvv
=== Test run single Module: source ansible_src/ansible/hacking/env-setup
Create instance
sudo ansible_src/ansible/hacking/test-module -m ansible_quicklabs/library_ext/ansible-kvm/library/kvm_cmd.py -a "action='instance-create' image_base='/mnt/nfv/kvm_openstack_lab/images/Fedora-Cloud-Base-24-1.2.x86_64.qcow2' image_format='qcow2' instance_name='/mnt/nfv/kvm_openstack_lab/instances/controller.qcow2' image_size=8G"
Boot instance
sudo ansible_src/ansible/hacking/test-module -m ansible_quicklabs/library_ext/ansible-kvm/library/kvm_cmd.py \
-a "action='boot' instance_name='/mnt/nfv/kvm_openstack_lab/instances/controller.qcow2' instance_cpus=1 instance_ram=1024 instance_vnc=:1 instance_cdrom=/mnt/nfv/kvm_openstack_lab/cloud-init/default/default-cidata.iso"
= Work log
REF