Uses SysPrep for Windows VM (depends on ‘guest_id’ parameter match ‘win’) with PyVmomi.

123 views
Skip to first unread message

esxi...@gmail.com

unread,
Mar 27, 2021, 3:01:43 PM3/27/21
to Ansible Project

Hello

Below is my playbook for the vm creation with  template which is windows server 2019

I saw notes for the module wrt sysprep in :


" Uses SysPrep for Windows VM (depends on ‘guest_id’ parameter match ‘win’) with PyVmomi."


But nothing in




So anyone can comment :

What happens if the template sysprep is done ?
What happens if the template sysprep NOT done ?



Playbook :


---
- hosts: localhost
  gather_facts: false
  connection: local
  vars_files:
    - ./vars/vars.yml

  tasks:
    - name: create vm using template
      vmware_guest:
        hostname: "{{ vcenter_server }}"
        username: "{{ vcenter_user }}"
        password: "{{ vcenter_pass }}"
        datacenter: "{{ vcenter_datacenter }}"
        cluster: "{{ vcenter_cluster }}"
        template: "{{ vcenter_template }}"
        validate_certs: no
        name: "{{ item }}"
        folder: /xxxx
        state: poweredon
        wait_for_ip_address: yes
        wait_for_customization: yes
        disk:
        - size_gb: 500
          type: thin
          datastore: xxx
        hardware:
          memory_mb: 16384
          num_cpus: 4
          num_cpu_cores_per_socket: 4
          scsi: paravirtual
        networks:
        - name: xxx
          start_connected: true
        customization:
          domain: "{{ joindomain_name }}"
          dns_servers:
            - x
            - x
          dns_suffix:
            - x
          joindomain: "{{ joindomain_name }}"
          autologon: false
          domainadmin: "{{domainadmin_name}}"
          domainadminpassword: "{{domainadminpassword_password}}"
          fullname: xx
          orgname: xx
          timezone: 33
          hostname: "{{ item }}"
      with_items: "{{ servers }}"




Thanks

Reply all
Reply to author
Forward
0 new messages