To follow up on this. Things I have found that help are:
Set up your networking in your template as close as possible to how you want it in your cloned VMs. I got a lot further once I set the networking up in my template VM as static (I need my clones to use static IPs). Remove device drivers from your template for any network devices which are no longer present (You can do this by starting Device Manager (devmgmt.msc) and clicking on 'Show hidden devices' on the View menu. If your VM gets stuck on the windows 'Getting Ready' screen, read this, as not only will it make you laugh and realise others have got past this particular hurdle: http://www.hurryupandwait.io/blog/getting-readytroubleshooting-unattended-windows-installation but also there's a tip in there that will help you debug what is going on. I had more success when I switched away from the virtual network adapters that require vmware tools - so instead of using VMXNet 3, things seemed to work better using device type: 'e1000e' - obviously this is somewhat hardware dependent so things may be different elsewhere. Again, set this up in the template as well is in your playbook. Hope this helps anyone else trying to do this. Jon On Thursday, October 12, 2017 at 4:51:44 PM UTC+1, J Hawkesworth wrote: > > 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/ec59f14c-b0fe-47db-b8bc-f50dbd415bcd%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
