Ansible with windows server 2008 r2 sp1 - sysprep

509 views
Skip to first unread message

Fernando Henrique Borges

unread,
Jul 6, 2017, 1:11:24 PM7/6/17
to Ansible Project
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: us...@lab.intranet
      password: *******
      datacenter: DC
      folder: /POC/Ansible
      esxi_hostname: es...@lab.intranet
      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: user...@lab.intranet
        domainadminpassword: *********

J Hawkesworth

unread,
Jul 7, 2017, 6:08:42 AM7/7/17
to Ansible Project
Maybe you need to use runonce to run the powershell script to enable remoting:


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
Reply all
Reply to author
Forward
0 new messages