Re: [ansible-project] How to pass information/variable while creating VM on esxxi server using Vmware_guest module
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. On Friday, 10 January 2020 19:31:41 UTC+5:30, naveen s wrote: > > 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 > > > Thanks & Regards, > Naveen Sangadala > (+91 7676257193) > > > On Fri, Jan 10, 2020 at 7:07 PM Rohan Kalap > wrote: > >> 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- >> --- >> - hosts: localhost >> gather_facts: no >> tasks: >> - debug: >> msg: connection to host machine successful >> >> - name: create test1 vm from esxi server >> #expect: >> #command: "configuration file!" >> #responses: >> #'PRESS \ TO CONTINUE:': '' >> vmware_guest: >> hostname: "x.x.x.x" >> username: "root" >> password: "password" >> validate_certs: no >> folder: /ha-datacenter/vm/ >> name: "test-vm" >> state: poweredon >> guest_id: centos64Guest >> esxi_hostname: "hostname" >> disk: >> - size_gb: 160 >> type: thin >> datastore: datastore1 >> hardware: >> memory_mb: 3000 >> num_cpus: 4 >> scsi: paravirtual >> cdrom: >> type: iso >> iso_path: "[datastore1] centos.iso" >> # expect: >> # command: "configuration!" >> # responses: >> #'PRESS \ TO CONTINUE:': '' >> >> customization: >> # i tried using customization attribute but of no use >> hostname: "hostname" >> domain: "network" >> networks: >> - name: VM Network >> mac: aa:bb:dd:aa:00:23 >> ip: x.x.x.x >> netmask: 255.255.255.0 >> device_type: vmxnet3 >> wait_for_ip_address: yes >> delegate_to: localhost >> register: deploy_vm >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Ansible Project" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to ansible...@googlegroups.com . >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/ansible-project/3713e737-2147-4978-9fcb-28a22f371ee2%40googlegroups.com >> >> <https://groups.google.com/d/msgid/ansible-project/3713e737-2147-4978-9fcb-28a22f371ee2%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/46975391-01a1-4c5e-b705-3fed5b429010%40googlegroups.com.
Re: [ansible-project] How to pass information/variable while creating VM on esxxi server using Vmware_guest module
Can you please help in this module Or suggest modules which will be useful in this case. Please do the needful as i have to complete this task in given deadline. Thank you. On Monday, 13 January 2020 11:56:57 UTC+5:30, Rohan Kalap wrote: > > 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. > > On Friday, 10 January 2020 21:09:10 UTC+5:30, Abhijeet Kasurde wrote: >> >> 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 >> 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, >> >> On Fri, Jan 10, 2020 at 7:07 PM Rohan Kalap wrote: >> >>> 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- >>> --- >>> - hosts: localhost >>> gather_facts: no >>> tasks: >>> - debug: >>> msg: connection to host machine successful >>> >>> - name: create test1 vm from esxi server >>> #expect: >>> #command: "configuration file!" >>> #responses: >>> #'PRESS \ TO CONTINUE:': '' >>> vmware_guest: >>> hostname: "x.x.x.x" >>> username: "root" >>> password: "password" >>> validate_certs: no >>> folder: /ha-datacenter/vm/ >>> name: "test-vm" >>> state: poweredon >>> guest_id: centos64Guest >>> esxi_hostname: "hostname" >>> disk: >>> - size_gb: 160 >>> type: thin >>> datastore: datastore1 >>> hardware: >>> memory_mb: 3000 >>> num_cpus: 4 >>> scsi: paravirtual >>> cdrom: >>> type: iso >>> iso_path: "[datastore1] centos.iso" >>> # expect: >>> # command: "configuration!" >>> # responses: >>> #'PRESS \ TO CONTINUE:': '' >>> >>> customization: >>> # i tried using customization attribute but of no use >>> hostname: "hostname" >>> domain: "network" >>> networks: >>> - name: VM Network >>> mac: aa:bb:dd:aa:00:23 >>> ip: x.x.x.x >>> netmask: 255.255.255.0 >>> device_type: vmxnet3 >>> wait_for_ip_address: yes >>> delegate_to: localhost >>> register: deploy_vm >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Ansible Project" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to ansible...@googlegroups.com. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/ansible-project/3713e737-2147-4978-9fcb-28a22f371ee2%40googlegroups.com >>> >>> <https://groups.google.com/d/msgid/ansible-project/3713e737-2147-4978-9fcb-28a22f371ee2%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >> >> >> -- >> Thanks, >> Abhijeet Kasurde >> > -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/d8fc0973-96f6-456f-aec4-f0e75cb4dfcd%40googlegroups.com.
Re: [ansible-project] How to pass information/variable while creating VM on esxxi server using Vmware_guest module
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. On Friday, 10 January 2020 21:09:10 UTC+5:30, Abhijeet Kasurde wrote: > > 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 > 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, > > On Fri, Jan 10, 2020 at 7:07 PM Rohan Kalap > wrote: > >> 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- >> --- >> - hosts: localhost >> gather_facts: no >> tasks: >> - debug: >> msg: connection to host machine successful >> >> - name: create test1 vm from esxi server >> #expect: >> #command: "configuration file!" >> #responses: >> #'PRESS \ TO CONTINUE:': '' >> vmware_guest: >> hostname: "x.x.x.x" >> username: "root" >> password: "password" >> validate_certs: no >> folder: /ha-datacenter/vm/ >> name: "test-vm" >> state: poweredon >> guest_id: centos64Guest >> esxi_hostname: "hostname" >> disk: >> - size_gb: 160 >> type: thin >> datastore: datastore1 >> hardware: >> memory_mb: 3000 >> num_cpus: 4 >> scsi: paravirtual >> cdrom: >> type: iso >> iso_path: "[datastore1] centos.iso" >> # expect: >> # command: "configuration!" >> # responses: >> #'PRESS \ TO CONTINUE:': '' >> >> customization: >> # i tried using customization attribute but of no use >> hostname: "hostname" >> domain: "network" >> networks: >> - name: VM Network >> mac: aa:bb:dd:aa:00:23 >> ip: x.x.x.x >> netmask: 255.255.255.0 >> device_type: vmxnet3 >> wait_for_ip_address: yes >> delegate_to: localhost >> register: deploy_vm >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Ansible Project" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to ansible...@googlegroups.com . >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/ansible-project/3713e737-2147-4978-9fcb-28a22f371ee2%40googlegroups.com >> >> <https://groups.google.com/d/msgid/ansible-project/3713e737-2147-4978-9fcb-28a22f371ee2%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > > > -- > Thanks, > Abhijeet Kasurde > -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/a878f55a-fed8-456f-a74a-e39f1e94bc4a%40googlegroups.com.
[ansible-project] How to pass information/variable while creating VM on esxxi server using Vmware_guest module
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- --- - hosts: localhost gather_facts: no tasks: - debug: msg: connection to host machine successful - name: create test1 vm from esxi server #expect: #command: "configuration file!" #responses: #'PRESS \ TO CONTINUE:': '' vmware_guest: hostname: "x.x.x.x" username: "root" password: "password" validate_certs: no folder: /ha-datacenter/vm/ name: "test-vm" state: poweredon guest_id: centos64Guest esxi_hostname: "hostname" disk: - size_gb: 160 type: thin datastore: datastore1 hardware: memory_mb: 3000 num_cpus: 4 scsi: paravirtual cdrom: type: iso iso_path: "[datastore1] centos.iso" # expect: # command: "configuration!" # responses: #'PRESS \ TO CONTINUE:': '' customization: # i tried using customization attribute but of no use hostname: "hostname" domain: "network" networks: - name: VM Network mac: aa:bb:dd:aa:00:23 ip: x.x.x.x netmask: 255.255.255.0 device_type: vmxnet3 wait_for_ip_address: yes delegate_to: localhost register: deploy_vm -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/3713e737-2147-4978-9fcb-28a22f371ee2%40googlegroups.com.