Using Packer 1.3.0 to create kvm Windows Server 2016/2012R2 VM's using
ansible 2.6.3
I get "random" errors during execution. I can run the same packer run
several time(s) and will get error(s) at different places each time. An
example is below:
A partial log output is below:
[1;32m==> qemu: Machine successfully restarted, moving on [0m
[1;32m==> qemu: Provisioning with Ansible... [0m
[1;32m==> qemu: Executing Ansible: ansible-playbook --extra-vars
packer_build_name=qemu packer_builder_type=qemu -i
/tmp/packer-provisioner-ansible227724354
/opt/jenkins/workspace/lates_2016_imagebuild_PR-13-MRQF4SZQDV6W2IPY6NIULRNOV52IVSKY2AZX2JAUYARBUS2VTMNA/windows/ansible/wsus_config.yaml
-e ansible_ssh_private_key_file=/tmp/ansible-key136914095 --extra-vars
packer_http_addr=10.0.2.2:8065 --connection packer --extra-vars
ansible_shell_type=powershell ansible_shell_executable=None [0m
[0;32m qemu: [0m
[0;32m qemu: PLAY [all]
********************************************************************* [0m
[0;32m qemu: [0m
[0;32m qemu: TASK [Configure Root Registry Key WindowsUpdate]
******************************* [0m
[0;32m qemu: changed: [default] [0m
[0;32m qemu: [0m
[0;32m qemu: TASK [Configure Root Registry Key AU]
****************************************** [0m
[0;32m qemu: changed: [default] [0m
[0;32m qemu: [0m
[0;32m qemu: TASK [Configure Root Registry Key
CurrentVersionWindowsUpdate] **************** [0m
[0;32m qemu: changed: [default] [0m
[0;32m qemu: [0m
[0;32m qemu: TASK [Configure Root Registry Key CurrentVersion AU]
*************************** [0m
[0;32m qemu: changed: [default] [0m
[0;32m qemu: [0m
[0;32m qemu: TASK [Configure Registry Key UseWUServer]
************************************** [0m
[0;32m qemu: changed: [default] [0m
[0;32m qemu: [0m
[0;32m qemu: TASK [Configure Registry Key NoAutoUpdate]
************************************* [0m
[0;32m qemu: changed: [default] [0m
[0;32m qemu: [0m
[0;32m qemu: TASK [Configure Registry Key DetectionFrequency]
******************************* [0m
[0;32m qemu: changed: [default] [0m
[0;32m qemu: [0m
[0;32m qemu: TASK [Configure Registry Key DetectionFrequencyEnabled]
************************ [0m
[0;32m qemu: changed: [default] [0m
[0;32m qemu: [0m
[0;32m qemu: TASK [Configure Registry Key AUOptions]
**************************************** [0m
[0;32m qemu: [WARNING]: Error deleting remote temporary files (rc: 6,
stderr: }) [0m
[0;32m qemu: changed: [default] [0m
[0;32m qemu: [0m
[0;32m qemu: TASK [Configure Registry Key WUServer]
***************************************** [0m
[0;32m qemu: fatal: [default]: FAILED! => {"msg": "failed to transfer file
to /home/linux_eng/.ansible/tmp/ansible-local-63783zCgNjm/tmpbX_ouB
'C:\\Users\\<obfuscated>tmp\\AppData\\Local\\Temp\\ansible-tmp-1537212675.83-235265198325172\\win_regedit.ps1':\n\n\n"}
[0m
[0;32m qemu: to retry, use: --limit
@/opt/jenkins/workspace/lates_2016_imagebuild_PR-13-MRQF4SZQDV6W2IPY6NIULRNOV52IVSKY2AZX2JAUYARBUS2VTMNA/windows/ansible/wsus_config.retry
[0m
[0;32m qemu: [0m
[0;32m qemu: PLAY RECAP
********************************************************************* [0m
[0;32m qemu: default : ok=9 changed=9
unreachable=0 failed=1 [0m
[0;32m qemu: [0m
[1;32m==> qemu: Deleting output directory... [0m
[1;31mBuild 'qemu' errored: Error executing Ansible: Non-zero exit status:
exit status 2 [0m
==> Some builds didn't complete successfully and had errors:
--> qemu: Error executing Ansible: Non-zero exit status: exit status 2
==> Builds finished but no artifacts were created.
My playbook in question looks like:
---
- hosts: all
gather_facts: False
tasks:
- name: Configure Root Registry Key WindowsUpdate
win_regedit:
path: HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate
- name: Configure Root Registry Key AU
win_regedit:
path: HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU
- name: Configure Root Registry Key CurrentVersionWindowsUpdate
win_regedit:
path: HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate
- name: Configure Root Registry Key CurrentVersion AU
win_regedit:
path: HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto
Update
- name: Configure Registry Key UseWUServer
win_regedit:
path: HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU
name: UseWUServer
data: 1
type: dword
- name: Configure Registry Key NoAutoUpdate
win_regedit:
path: HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU
name: NoAutoUpdate
data: 1
type: dword
- name: Configure Registry Key DetectionFrequency
win_regedit:
path: HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU
name: DetectionFrequency
data: 12
type: dword
- name: Configure Registry Key DetectionFrequencyEnabled
win_regedit:
path: HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU
name: DetectionFrequencyEnabled
data: 12
type: dword
- name: Configure Registry Key AUOptions
win_regedit:
path: HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU
name: AUOptions
data: 2
type: dword
- name: Configure Registry Key WUServer
win_regedit:
path: HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate
name: WUServer
data: 'http://wsusapwprh1.<obfuscated>.com:8530'
type: string
- name: Configure Registry Key WUStatusServer
win_regedit:
path: HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate
name: WUStatusServer
data: 'http://wsusapwprh1.<obfuscated>.com:8530'
type: string
- name: Configure Registry Key TargetGroup
win_regedit:
path: HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate
name: TargetGroup
data: '<obfuscated>_nonprod'
type: string
- name: Configure Registry Key TargetGroupEnabled
win_regedit:
path: HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate
name: TargetGroupEnabled
data: 1
type: dword
- name: Configure Registry Key NoAutoRebootWithLoggedOnUsers
win_regedit:
path: HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU
name: NoAutoRebootWithLoggedOnUsers
data: 1
type: dword
- name: Configure Registry Key RebootRelaunchTimeoutEnabled
win_regedit:
path: HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU
name: RebootRelaunchTimeoutEnabled
data: 1
type: dword
- name: Configure Registry Key RebootRelaunchTimeout
win_regedit:
path: HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU
name: RebootRelaunchTimeout
data: 1440
type: dword
- name: Configure CurrentVersion Registry Key ForcedReboot
win_regedit:
path: HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto
Update
name: ForcedReboot
data: 0
type: dword
- name: Configure CurrentVersion Registry Key AUOptions
win_regedit:
path: HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto
Update
name: AUOptions
data: 2
type: dword
- name: Configure CurrentVersion Registry Key ElevateNonAdmins
win_regedit:
path: HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate
name: ElevateNonAdmins
data: 0
type: dword
Previously i was running this with Packer 1.2.X and ansibe 2.5.2 and it ran
reliably without issue. Is anyone aware of any issues/bugs
with recent packer/ansible versions that might cause this?
--
This mailing list is governed under the HashiCorp Community Guidelines -
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of
those guidelines may result in your removal from this mailing list.
GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
---
You received this message because you are subscribed to the Google Groups
"Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/packer-tool/93002e43-fcaf-4226-977e-e918c68f2bec%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.