Re: [ansible-project] Re: How can I run the commnads in Linux vm after creation with vmware_guest
Hi Aravind, This will execute the commands on the vm whenever I run the playbook. But I want to run the commands when vm is created only. Thanks, Phani Akkina On Thu, Sep 19, 2019 at 11:39 AM Aravind Balaji wrote: > Hi Phani Akkina > > Here is the example: > > - name: Create a virtual machine on given ESXi hostname > vmware_guest: > hostname: "{{ vcenter_hostname }}" > username: "{{ vcenter_username }}" > password: "{{ vcenter_password }}" > validate_certs: no > folder: /DC1/vm/ > name: test_vm_0001 > state: poweredon > guest_id: centos64Guest > # This is hostname of particular ESXi server on which user wants VM to > be deployed > esxi_hostname: "{{ esxi_hostname }}" > disk: > - size_gb: 10 > type: thin > datastore: datastore1 > hardware: > memory_mb: 512 > num_cpus: 4 > scsi: paravirtual > networks: > - name: VM Network > mac: aa:bb:dd:aa:00:14 > ip: 10.10.10.100 > netmask: 255.255.255.0 > device_type: vmxnet3 > wait_for_ip_address: yes > delegate_to: localhost > register: deploy_vm > > - name: Change hostname of guest machine > vmware_vm_shell: > hostname: "{{ vcenter_hostname }}" > username: "{{ vcenter_username }}" > password: "{{ vcenter_password }}" > validate_certs: no > datacenter: "DC1" > folder: "/DC1/vm" > vm_id: "{{ vm_name }}" > vm_username: testUser > vm_password: SuperSecretPassword > vm_shell: "/usr/bin/hostnamectl" > vm_shell_args: "set-hostname new_hostname > /tmp/$$.txt 2>&1" > delegate_to: localhost > > > ** > *Thanks & Regards*, > Aravind Balaji S > > -- > 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/48c69d43-5436-41f0-9578-baa452e6ff3e%40googlegroups.com > <https://groups.google.com/d/msgid/ansible-project/48c69d43-5436-41f0-9578-baa452e6ff3e%40googlegroups.com?utm_medium=email_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/CAD85EYg4f57OYWZV0pmJzn66Kd9q_jd_iT6qeeOb6%2B79Pa%3DjUQ%40mail.gmail.com.
Re: [ansible-project] Re: How can I run the commnads in Linux vm after creation with vmware_guest
Hi Arvind, Thanks for your reply. I need to run the commands in Linux after the creation of the vm by vmware_guest. And these commands also need to run only once. Is that possible with vmware_vm_shell? If yes do you have any example? Thanks, Phani Akkina On Wed, Sep 18, 2019 at 3:03 PM Aravind Balaji wrote: > Hi phani akkina, > > With the help of vmware_vm_shell module( > https://docs.ansible.com/ansible/latest/modules/vmware_vm_shell_module.html) > you can execute command inside linux vm. > > *Thanks & Regards*, > Aravind Balaji S > > -- > 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/aeb18c87-6c85-4ee6-b2ec-76ac01c6f99f%40googlegroups.com > <https://groups.google.com/d/msgid/ansible-project/aeb18c87-6c85-4ee6-b2ec-76ac01c6f99f%40googlegroups.com?utm_medium=email_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/CAD85EYiqTctA2DdMg2hwg_GTx8R3P%2BHHtsZ3wH6BgD_OdXnxpA%40mail.gmail.com.
[ansible-project] How can I run the commnads in Linux vm after creation with vmware_guest
Hi All, I am deploying vms using *vmware_guest* module in vcenter. I need to run some commands after the creation of the vms either Windows or Linux. I am able run the commands in Windows with runonce. Now I blocked to know how to run the commands in Linux after creation. Can anyone guide me on this? Thanks, Phani Akkina -- 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/c88d60ff-cd5b-449d-8ff7-1a0688ac7e1c%40googlegroups.com.
[ansible-project] vmware_guest runonce is waiting at welcome screen to click OK
Hi All, We are trying to deploy the vms in vcenter and trying to execute some commands using runonce option. But runonce is waiting at welcome screen of the vm to manually click OK on a welcome message from the domain. [image: Welcome_screen.PNG] Thanks, Phani Akkina -- 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/2c64636a-3fbe-4df4-94e3-e66e7898af23%40googlegroups.com.