# How to pass information/variable while creating VM on esxxi server using Vmware\_guest module

**URL:** <https://forum.ansible.com/t/how-to-pass-information-variable-while-creating-vm-on-esxxi-server-using-vmware-guest-module/31946>\
**Category:** Ansible Project\
**Created:** [January 10, 2020, 1:37pm UTC](https://forum.ansible.com/t/how-to-pass-information-variable-while-creating-vm-on-esxxi-server-using-vmware-guest-module/31946 "2020-01-10T13:37:21Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rohan\_Kalap](https://avatars.discourse-cdn.com/v4/letter/r/7cd45c/32.png) [@Rohan\_Kalap](https://forum.ansible.com/u/Rohan_Kalap)\
**Post date:** [January 10, 2020, 1:37pm UTC](https://forum.ansible.com/t/how-to-pass-information-variable-while-creating-vm-on-esxxi-server-using-vmware-guest-module/31946/1 "2020-01-10T13:37:21Z")

</div>

Hello,

I am looking to create VM from vmware\_guest module on esxi server which is working fine with following playbook,  
But- I want to pass details which are needed while booting into VM e.g hostname, username or license agreement.

I tried using

1-custome values and

2-set\_facts but this doesn’t work under vmware\_guest module

is there any way to automate OS installation by providing variables?

this is my playbook-

---

<div class="post-metadata">

**Author:** ![naveen\_s](https://avatars.discourse-cdn.com/v4/letter/n/eada6e/32.png) [@naveen\_s](https://forum.ansible.com/u/naveen_s)\
**Post date:** [January 10, 2020, 2:01pm UTC](https://forum.ansible.com/t/how-to-pass-information-variable-while-creating-vm-on-esxxi-server-using-vmware-guest-module/31946/2 "2020-01-10T14:01:20Z")

</div>

Hello Rohan,

it is always better to have the variables and its values in the group\_vars section and pass them while executing the playbook.

1. created a reusable playbook (create a variable inside the playbook in which you want to pass it at the time of playbook execution).
2. create a group\_vars directory and create the vars.yml for all the variables values

please find the attachment for the code to launch a linux server in vmware.

and also refer my github page for the vmware playbooks if need anything.

[https://github.com/naveensangadala/Devops-Ansible-Playbooks-for-VMware-AWS-Azure-Cloud](https://github.com/naveensangadala/Devops-Ansible-Playbooks-for-VMware-AWS-Azure-Cloud)

> **(attachments)**
>
> [Vmware\_linux\_server\_creation.txt](https://forum.ansible.com/uploads/short-url/t6dzZouRUH1oEIinsbZJRB0bDmm.txt) (4.46 KB)  
> [group\_vars.txt](https://forum.ansible.com/uploads/short-url/lGBsamnUpBttxwFcwOkGJz2JXcb.txt) (337 Bytes)

---

<div class="post-metadata">

**Author:** ![Akasurde](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/akasurde/32/230_2.png) [@Akasurde](https://forum.ansible.com/u/Akasurde)\
**Post date:** [January 10, 2020, 3:38pm UTC](https://forum.ansible.com/t/how-to-pass-information-variable-while-creating-vm-on-esxxi-server-using-vmware-guest-module/31946/3 "2020-01-10T15:38:39Z")

</div>

Hi Rohan,

There are a number of ways to do this.

Take a look at Prompts - [https://docs.ansible.com/ansible/latest/user\_guide/playbooks\_prompts.html](https://docs.ansible.com/ansible/latest/user_guide/playbooks_prompts.html) which will be interactive like you explained in the original post.

But going forward you might want to use VMware guest templates and OVF images to customize and create new VMs. Take a look at “Clone from VM” and “Clone from template” in VMware. vmware\_guest also allows specifying customization specification created in vCenter Customization Specification Manager.

Also, as Naveen S suggested, you can also take a look at [this](https://github.com/hamburger-software/ansible-role-vmware_ubuntu_cloud_image) role which is a good start point.

Thanks,

---

<div class="post-metadata">

**Author:** ![Rohan\_Kalap](https://avatars.discourse-cdn.com/v4/letter/r/7cd45c/32.png) [@Rohan\_Kalap](https://forum.ansible.com/u/Rohan_Kalap)\
**Post date:** [January 13, 2020, 6:26am UTC](https://forum.ansible.com/t/how-to-pass-information-variable-while-creating-vm-on-esxxi-server-using-vmware-guest-module/31946/4 "2020-01-13T06:26:57Z")

</div>

Thanks Abhijeet,

I went through prompts document and yes we can pass values at execution **but those values will not be useful while OS installation on VM we have created I guess**.  
I have a case where **i need to pass information to EULA(end user licence agreement)** after creating vm through play, is it possible through ansible i am new so looking for ways to solve this issue.

Thanks for Reply.

---

<div class="post-metadata">

**Author:** ![Rohan\_Kalap](https://avatars.discourse-cdn.com/v4/letter/r/7cd45c/32.png) [@Rohan\_Kalap](https://forum.ansible.com/u/Rohan_Kalap)\
**Post date:** [January 17, 2020, 7:53am UTC](https://forum.ansible.com/t/how-to-pass-information-variable-while-creating-vm-on-esxxi-server-using-vmware-guest-module/31946/5 "2020-01-17T07:53:19Z")

</div>

Thank you,  
I went through your document it’s really helpful, I will try those. Will let you know if i am able to use it.
