Setting VM Configuration Parameters During Provisioning:

---
- name: Deploy VM with Guestinfo Parameter
  hosts: localhost
  gather_facts: no
  tasks:
    - name: Deploy VM
      community.vmware.vm_vm_drs_rule:
        validate_certs: no
        hostname: "{{ vcenter_hostname }}"
        username: "{{ vcenter_username }}"
        password: "{{ vcenter_password }}"
        cluster_name: "{{ cluster_name }}"
        datacenter_name: "{{ datacenter_name }}"
        state: poweredon
        name: my_vm
        template: my_template
        networks:
          - name: my_network
        customization_spec: my_customization_spec
        guestinfo:
          ipaddress: 192.168.0.2

Setting VM Configuration Parameters After Provisioning:
---
- name: Set VM Configuration Parameter After Provisioning
  hosts: localhost
  gather_facts: no
  tasks:
    - name: Get VM Facts
      community.vmware.vm_vm_facts:
        validate_certs: no
        hostname: "{{ vcenter_hostname }}"
        username: "{{ vcenter_username }}"
        password: "{{ vcenter_password }}"
        name: my_vm
      register: vm_facts

    - name: Set Guestinfo Parameter
      community.vmware.vm_vm_info:
        validate_certs: no
        hostname: "{{ vcenter_hostname }}"
        username: "{{ vcenter_username }}"
        password: "{{ vcenter_password }}"
        state: poweredon
        vm_id: "{{ vm_facts.instance.id }}"
        guestinfo:
          ipaddress: 192.168.0.2
On Wednesday, July 5, 2023 at 10:24:01 AM UTC-7 ppktm wrote:

> Hello,
>
> I am using ovf to deploy a new vm. Is it also possible to set VM 
> configuration parameters using ansible community.vmware ? After a vm is 
> provisioned , I need to add and set new configuration parameter such as: 
> guestinfo.ipaddress = 192.168.0.2
>
> Thanks!
> ppktm.
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/f324debd-616d-414a-aaeb-8ca8c1b2f38an%40googlegroups.com.

Reply via email to