This playbook uses Ansible to create virtual machines on host server. Create your own XML file for the VM and then run this playbook to create as many VMs as you like.
- The following packages should be installed on the host server
apt install ansible libguestfs-tool python3-libvirt
- Install the latest version of Ansible community general
ansible-galaxy collection install community.general
- You should create your own XML file for the VM to use as template.
- Enter the VM hostnames in the
vm_name.txt
file. For example:
srv16-mme-1
srv16-mme-2
.
.
.
- Edit the
kvm_provision.yaml
file and specify the resources for the server. - Place the .qcow2 base image in the
/var/lib/libvirt/images
and rename it tosample-mme-image.qcow2
- Place the sample coredump .qcow2 image in the
/data
directory and rename it tosample-coredump.qcow2
- Edit the VM template file under
roles/kvm_provision/templates/vm-template.xml.j2
to match your desired state. - Execute the
create_vm
script to start creating VMs.
- Edit the
configure_network.sh
file and specify the gateways for all intefaces. (OM,s1mme,s11,db) - Edit the
mme_name.txt
file in this directory and specify the information in this format:
MME_NAME OM_IP S1MME_IP S11_IP DB_IP
An example would be like this:
srv16-mme-1 172.17.93.80/22 172.17.80.194/27 172.17.56.34/27 172.17.88.194/27
- Make sure that all hostnames (e,g srv16-mme-1) resolve to the IP of the host machine libvirt interface. You can edit the /etc/hosts as so:
srv16-mme-1 192.168.10.1
- Execute the
configure_network.sh
script to start the configuration proccess.