I want to create vm in vsphere from template and customize OS with 
customization spec

I am not sure how to apply a customization spec in ansible. any idea?

will something like this work

---

- hosts: localhost

  gather_facts: true

  connection: local

  vars_files:

    - vcenter_creds.yml

    - vars.yml

  #no_log: True 

  tasks:

    - name: Clone the VM template and customize

      vmware_guest:

        hostname: "{{ vcenter_hostname }}"

        username: "{{ vcenter_username }}"

        password: "{{ vcenter_password }}"

        validate_certs: False

        name: ansible-vm

        template: "{{ template_name }}"

        datacenter: "{{ datacenter_name }}"

        folder: "/{{ datacenter_name }}/vm/Ansible-test"

        cluster: "{{ cluster_name }}"

        datastore: "{{ datastore_name }}"

        networks:

          - name: VLAN-111

            start_connected: yes

            ip: "{{ vm_ip }}"

            netmask: "{{ vm_netmask }}"

            gateway: "{{ vm_gateway }}"

            type: static

            dns_servers: "{{ vm_dns_servers }}"

        customization:

          hostname: "ansible-vm"

          dns_servers: "{{ vm_dns_servers }}"

        state: poweredon

        wait_for_ip_address: yes

      delegate_to: localhost

 

-- 
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/b4729a2b-c090-46a2-82a8-006a1410b264n%40googlegroups.com.

Reply via email to