Kayıtlar

2018 tarihine ait yayınlar gösteriliyor

create Virtual Machines in VMware with ansible

Hi

Mainly I am a system administrator. To live freely, I work  project based and I give trainings. In my current project, I have some additional roles which include managing a vmware environment.

I must create new VMs in vsphere 6.5 environment fast. I have ansible under by belt. so here how I have done this.

Scenario: I have 5 VMs to create. My config files are the following;

testVM.csv: this includes VM properties such as datastore, Network config etc. My each VM has 3 NICs.. If you need less, then you can trim these items in the csv filemakeVM.yml: it creates VMs according to testVM.csv file. you will need Pyvmomi python library. you can install it with pipcreds.txt: vcenter credentials are herehosts file: this must include only one IP. otherwise ansible tries to create a VM for each host in this file..

csv file format:
VMname;cpuCount;MemorySize;diskSize;dataStoreName;PortGroupName_NIC1;IP_NIC1;Netmask_NIC1;defGW_NIC1;PortGroupName_NIC2;IP_NIC2;Netmask_NIC1;defGW_NIC2;PortGroupName_…