Deploy a vm using ansible playbook

In this article i’m going to shar the steps of deploy a vm using ansible playboook

I’m using two yaml files for this excersice.

in the vars.yml file I”m proving the vcenter environment details as a variables.

I have defined vcener fqdn,datacenter name, credential and vm template name.

Also I have disabled ssl verification sing vcenter_validate_certs: false parameter. The reason is we are using self sign ssl in our vcenter and its not trusted in the linux vm which i’m using to run this playbook.

in the second yml file(vm_deploy.yml).In this playbook i’m grabbing inputs from vars.yml. Other than that Ive added vmname , folder name , power state and wait for ip option here.

Now we can run this play book.

I have added these yml files to below github.

https://github.com/darshanajayathilake/ansiblevmdeploy

Advertisement