Maybe you need to use runonce to run the powershell script to enable 
remoting:

https://docs.ansible.com/ansible/vmware_guest_module.html

Be aware that unpatched Windows Server 2008 R2 has a bug in WMF 3.0 which 
stops winrm from being able to do anything useful. You need to 
install http://support.microsoft.com/kb/2842230 or get it up to date with 
windows updates before even running the setup module to gather facts 
against it.

Hope this helps,

Jon


On Thursday, July 6, 2017 at 6:11:24 PM UTC+1, Fernando Henrique Borges 
wrote:
>
> Hi.
>
> I deployed one VM (Vcenter Server/ESXi 5.5.0) from windows server 2008 r2 
> template using ansible playbook. 
> Now I 'd like to initialize it, but the vm is configured with sysprep, 
> When the ansible start the vm, it stop in the windows startup.
>
>  hosts: localhost
>   connection: local
>   gather_facts: False
>   tasks:
>   - name: Create a VM from Template
>     vmware_guest:
>       validate_certs: false
>       hostname: vcenterserver.lab.intranet
>       username: [email protected]
>       password: *******
>       datacenter: DC
>       folder: /POC/Ansible
>       esxi_hostname: [email protected]
>       name: win1
>       state: poweredon
>       template: TPL_W2008_STD_R2_SP1
>       disk:
>         type: thin
>         datastore: "LUN_POC_DS8870_1TB_01"
>       networks:
>       - name: Lab
>         ip: 192.168.12.15
>         netmask: 255.255.255.0
>       customization:
>         autologon: True
>         dns_servers:
>         - 192.168.12.10
>         joindomain: lab.intranet
>         domainadmin: [email protected]
>         domainadminpassword: *********
>
>

-- 
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/8a91766a-ac4c-44d6-8469-26a7f720a606%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to