Hello,

Can anyone tell me the steps I need to go through to get vmware_guest to 
successfully clone a template and have the clone join an existing domain?

Once the clone comes up, it never seems to have network access, so domain 
joining always fails.
A lot of times I have tried the network connection profile is marked as 
'public' and isn't given access to the internet.  

I need to allocate a static IP 

I found some link suggesting you have to use sysprep, but if you do so, you 
have to set language, product key etc manually and to be worthwhile the 
process needs to be fully automatic.  Problems seem to start before that 
with the networking.

All suggestions gratefully received!

Tried with ansible 2.3 and 2.4 and two different windows templates, one 
created afresh from ISO .

Playbook below.

Jon


- hosts: localhost
  gather_facts: true

- hosts: new
  gather_facts: false
  vars:
    template: New2012R2Template
  vars_prompt:
     - name: 'vmware_user'
       prompt: 'Enter VMWare username'
       private: no
     - name: 'vmware_cred'
       prompt: 'Enter VMWare password'
       private: yes
  pre_tasks:
    - name: show what we are planning on doing
      debug:
         msg: "ensure vm with hostname {{inventory_hostname}} and ip 
{{hostvars[inventory_hostname]['ip']}} exists."

    - name: clone vmware template and customise so it is ready for use as 
domain member
      vmware_guest:
         annotation: "Ansible cloned from template '{{template}}' on 
{{hostvars['localhost']['ansible_date_time']['date']}} by {{vmware_user}}"
         cluster: Dev Cluster
         datacenter: Dev
         folder: /Development/
         hostname: vsphere6
         name: "{{inventory_hostname}}"
         password: "{{ vmware_cred }}"
         resource_pool: Normal
         state: poweredon
         template: "{{template}}"
         username: '{{vmware_user}}'
         validate_certs: no
         networks:
          - name: VM Network
            devicetype: vmxnet3
#            domain: devdomain.local
            gateway: redacted_ip0
            ip: "{{hostvars[inventory_hostname]['ip']}}"
            netmask: 255.255.128.0
            type: static
            dns_servers:
              - redacted_ip1
              - redacted_ip2
         customization:
           autologon: yes
           autologoncount: 5
           dns_servers:
             - redacted_ip1
             - redacted_ip2
#           domain: devdomain.local
           password: "{{setup_password}}"
           joindomain: dcmalvern.smcorp.speechmachines.com
           domainadmin: "{{ dom_admin_user }}"
           domainadminpassword: "{{ dom_admin_password }}"
           runonce:
             - powershell.exe -ExecutionPolicy Unrestricted -File 
C:\Users\Administrator\Downloads\ConfigureRemotingForAnsible.ps1 
-ForceNewSSLCert
             - C:\finishsetup.bat
      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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/9cd9877b-12b2-4aad-a975-86ab87454dce%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to