{
"variables": {
"aws_access_key": "",
"aws_secret_key": ""
},
"builders": [{
"type": "amazon-ebs",
"access_key": "{{user `aws_access_key`}}",
"secret_key": "{{user `aws_secret_key`}}",
"region": "eu-west-2",
"vpc_id": "vpc-071989c63a4a111a2",
"subnet_id": "subnet-04e9835b580b420b4",
"source_ami": "ami-00ab607c2193c70c9",
"instance_type": "t2.micro",
"ami_name": "Windows Core 1809 {{timestamp}}",
"user_data_file": "./user_data.ps1",
"communicator": "winrm",
"winrm_username": "Administrator",
"winrm_use_ssl": true,
"winrm_insecure": true,
"run_tags": [
{ "windows": "" }
]
}],
"provisioners": [
{
"type": "ansible",
"playbook_file": "../playbooks/windows_image_build/playbook.yml",
"extra_arguments": [
"--extra-vars", "{'environment_name': 'packer', 'hosting_environment': 'aws', 'connection': 'packer'}",
"--skip-tags", "gitchecks",
"--skip-tags", "gather_facts",
"--skip-tags", "slack"
]
}
]
}
==> amazon-ebs: Provisioning with Ansible...
==> amazon-ebs: Executing Ansible: ansible-playbook --extra-vars packer_build_name=amazon-ebs packer_builder_type=amazon-ebs -i /tmp/packer-provisioner-ansible213362483 /home/richard/git/ansible/playbooks/windows_image_build/playbook.yml --private-key /tmp/ansible-key656970276 --extra-vars environment_name=packer --extra-vars hosting_environment=aws --extra-vars connection=packer --skip-tags gitchecks --skip-tags gather_facts --skip-tags slack
amazon-ebs: [WARNING]: Found variable using reserved name: connection
amazon-ebs:
amazon-ebs: PLAY [all] *********************************************************************
amazon-ebs:
amazon-ebs: TASK [Gathering Facts] *********************************************************
amazon-ebs: fatal: [default]: UNREACHABLE! => {"changed": false, "msg": "Authentication or permission failure. In some cases, you may have been able to authenticate and did not have permissions on the target directory. Consider changing the remote tmp path in ansible.cfg to a path rooted in \"/tmp\". Failed command was: ( umask 77 && mkdir -p \"` echo ~/.ansible/tmp/ansible-tmp-1565621734.13375-223774312712604 `\" && echo ansible-tmp-1565621734.13375-223774312712604=\"` echo ~/.ansible/tmp/ansible-tmp-1565621734.13375-223774312712604 `\" ), exited with result 1", "unreachable": true}
amazon-ebs: to retry, use: --limit @/home/richard/git/ansible/playbooks/windows_image_build/playbook.retry
amazon-ebs:
amazon-ebs: PLAY RECAP *********************************************************************
amazon-ebs: default : ok=0 changed=0 unreachable=1 failed=0
plugin: aws_ec2
regions:
- eu-west-2
filters:
tag:Name: Packer Builder
compose:
ansible_host: private_ip_address
hostnames:
- network-interface.addresses.private-ip-address
ansible_connection: winrm
ansible_winrm_transport: ntlm
ansible_winrm_server_cert_validation: ignore
ansible_port: 5986
ansible_winrm_scheme: https
--
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 packer-tool...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/9eb4db18-0ea0-478c-a569-ba4adda97b84%40googlegroups.com.
2019/08/13 07:37:43 packer: 2019/08/13 07:37:43 [DEBUG] Password is blank, will retry...2019/08/13 07:37:49 ui: amazon-ebs: amazon-ebs: Password retrieved! amazon-ebs: amazon-ebs: Password retrieved!==> amazon-ebs: Waiting for WinRM to become available...2019/08/13 07:37:49 packer: 2019/08/13 07:37:49 Waiting for WinRM, up to timeout: 30m0s2019/08/13 07:37:49 ui: ==> amazon-ebs: Waiting for WinRM to become available...2019/08/13 07:37:54 packer: 2019/08/13 07:37:54 [INFO] Attempting WinRM connection...2019/08/13 07:37:54 packer: 2019/08/13 07:37:54 [DEBUG] connecting to remote shell using WinRM2019/08/13 07:38:01 ui: ==> amazon-ebs: Connected to WinRM!2019/08/13 07:38:01 packer: 2019/08/13 07:38:01 Running the provision hook==> amazon-ebs: Connected to WinRM!2019/08/13 07:38:01 [INFO] (telemetry) Starting provisioner ansible2019/08/13 07:38:01 ui: ==> amazon-ebs: Provisioning with Ansible...==> amazon-ebs: Provisioning with Ansible...2019/08/13 07:38:02 packer: 2019/08/13 07:38:02 SSH proxy: serving on 127.0.0.1:360052019/08/13 07:38:02 ui: ==> amazon-ebs: Executing Ansible: ansible-playbook --extra-vars packer_build_name=amazon-ebs packer_builder_type=amazon-ebs -i /tmp/packer-provisioner-ansible774557480 /home/richard/git/ansible/playbooks/windows_image_build/playbook.yml --private-key /tmp/ansible-key713730989 --extra-vars {'environment_name': 'packer', 'hosting_environment': 'aws', 'connection': 'packer'} --skip-tags gitchecks --skip-tags gather_facts --skip-tags slack==> amazon-ebs: Executing Ansible: ansible-playbook --extra-vars packer_build_name=amazon-ebs packer_builder_type=amazon-ebs -i /tmp/packer-provisioner-ansible774557480 /home/richard/git/ansible/playbooks/windows_image_build/playbook.yml --private-key /tmp/ansible-key713730989 --extra-vars {'environment_name': 'packer', 'hosting_environment': 'aws', 'connection': 'packer'} --skip-tags gitchecks --skip-tags gather_facts --skip-tags slack2019/08/13 07:38:03 ui: amazon-ebs: [WARNING]: Found variable using reserved name: connection amazon-ebs: [WARNING]: Found variable using reserved name: connection amazon-ebs:2019/08/13 07:38:03 ui: amazon-ebs:2019/08/13 07:38:03 ui: amazon-ebs: PLAY [all] ********************************************************************* amazon-ebs: PLAY [all] *********************************************************************2019/08/13 07:38:03 ui: amazon-ebs: amazon-ebs:2019/08/13 07:38:03 ui: amazon-ebs: TASK [Gathering Facts] ********************************************************* amazon-ebs: TASK [Gathering Facts] *********************************************************2019/08/13 07:38:03 packer: 2019/08/13 07:38:03 SSH proxy: accepted connection2019/08/13 07:38:03 packer: 2019/08/13 07:38:03 authentication attempt from 127.0.0.1:41696 to 127.0.0.1:36005 as richard using none2019/08/13 07:38:03 packer: 2019/08/13 07:38:03 authentication attempt from 127.0.0.1:41696 to 127.0.0.1:36005 as richard using publickey2019/08/13 07:38:03 packer: 2019/08/13 07:38:03 new env request: LANG=en_GB.UTF-82019/08/13 07:38:03 packer: 2019/08/13 07:38:03 new exec request: /bin/sh -c 'echo ~richard && sleep 0'2019/08/13 07:38:03 packer: 2019/08/13 07:38:03 [INFO] starting remote command: /bin/sh -c 'echo ~richard && sleep 0'2019/08/13 07:38:03 packer: 2019/08/13 07:38:03 [INFO] command '/bin/sh -c 'echo ~richard && sleep 0'' exited with code: 12019/08/13 07:38:03 packer: 2019/08/13 07:38:03 [INFO] RPC endpoint: Communicator ended with: 12019/08/13 07:38:03 [INFO] 0 bytes written for 'stdout'2019/08/13 07:38:03 [INFO] 44 bytes written for 'stderr'2019/08/13 07:38:03 [INFO] RPC client: Communicator ended with: 12019/08/13 07:38:03 [INFO] RPC endpoint: Communicator ended with: 12019/08/13 07:38:03 [INFO] 0 bytes written for 'stdin'2019/08/13 07:38:03 packer: 2019/08/13 07:38:03 [INFO] 0 bytes written for 'stdout'2019/08/13 07:38:03 packer: 2019/08/13 07:38:03 [INFO] 44 bytes written for 'stderr'2019/08/13 07:38:03 packer: 2019/08/13 07:38:03 [INFO] RPC client: Communicator ended with: 12019/08/13 07:38:03 packer: 2019/08/13 07:38:03 [INFO] 0 bytes written for 'stdin'2019/08/13 07:38:03 packer: 2019/08/13 07:38:03 new env request: LANG=en_GB.UTF-82019/08/13 07:38:03 packer: 2019/08/13 07:38:03 new exec request: /bin/sh -c 'echo "`pwd`" && sleep 0'2019/08/13 07:38:03 packer: 2019/08/13 07:38:03 [INFO] starting remote command: /bin/sh -c 'echo "`pwd`" && sleep 0'2019/08/13 07:38:03 packer: 2019/08/13 07:38:03 [INFO] command '/bin/sh -c 'echo "`pwd`" && sleep 0'' exited with code: 12019/08/13 07:38:03 packer: 2019/08/13 07:38:03 [INFO] RPC endpoint: Communicator ended with: 12019/08/13 07:38:03 [INFO] 44 bytes written for 'stderr'2019/08/13 07:38:03 [INFO] 0 bytes written for 'stdout'2019/08/13 07:38:03 [INFO] RPC client: Communicator ended with: 12019/08/13 07:38:03 [INFO] RPC endpoint: Communicator ended with: 12019/08/13 07:38:03 [INFO] 0 bytes written for 'stdin'2019/08/13 07:38:03 packer: 2019/08/13 07:38:03 [INFO] 0 bytes written for 'stdout'2019/08/13 07:38:03 packer: 2019/08/13 07:38:03 [INFO] 44 bytes written for 'stderr'2019/08/13 07:38:03 packer: 2019/08/13 07:38:03 [INFO] RPC client: Communicator ended with: 12019/08/13 07:38:03 packer: 2019/08/13 07:38:03 [INFO] 0 bytes written for 'stdin'2019/08/13 07:38:03 packer: 2019/08/13 07:38:03 new env request: LANG=en_GB.UTF-82019/08/13 07:38:03 packer: 2019/08/13 07:38:03 new exec request: /bin/sh -c '( umask 77 && mkdir -p "` echo ~/.ansible/tmp/ansible-tmp-1565678283.204747-204856165820508 `" && echo ansible-tmp-1565678283.204747-204856165820508="` echo ~/.ansible/tmp/ansible-tmp-1565678283.204747-204856165820508 `" ) && sleep 0'2019/08/13 07:38:03 packer: 2019/08/13 07:38:03 [INFO] starting remote command: /bin/sh -c '( umask 77 && mkdir -p "` echo ~/.ansible/tmp/ansible-tmp-1565678283.204747-204856165820508 `" && echo ansible-tmp-1565678283.204747-204856165820508="` echo ~/.ansible/tmp/ansible-tmp-1565678283.204747-204856165820508 `" ) && sleep 0'2019/08/13 07:38:03 packer: 2019/08/13 07:38:03 [INFO] command '/bin/sh -c '( umask 77 && mkdir -p "` echo ~/.ansible/tmp/ansible-tmp-1565678283.204747-204856165820508 `" && echo ansible-tmp-1565678283.204747-204856165820508="` echo ~/.ansible/tmp/ansible-tmp-1565678283.204747-204856165820508 `" ) && sleep 0'' exited with code: 12019/08/13 07:38:03 [INFO] 0 bytes written for 'stdout'2019/08/13 07:38:03 [INFO] 44 bytes written for 'stderr'2019/08/13 07:38:03 [INFO] RPC client: Communicator ended with: 12019/08/13 07:38:03 [INFO] RPC endpoint: Communicator ended with: 12019/08/13 07:38:03 [INFO] 0 bytes written for 'stdin'2019/08/13 07:38:03 packer: 2019/08/13 07:38:03 [INFO] RPC endpoint: Communicator ended with: 12019/08/13 07:38:03 packer: 2019/08/13 07:38:03 [INFO] 0 bytes written for 'stdout'2019/08/13 07:38:03 packer: 2019/08/13 07:38:03 [INFO] 44 bytes written for 'stderr'2019/08/13 07:38:03 packer: 2019/08/13 07:38:03 [INFO] RPC client: Communicator ended with: 12019/08/13 07:38:03 packer: 2019/08/13 07:38:03 [INFO] 0 bytes written for 'stdin'2019/08/13 07:38:03 ui: amazon-ebs: fatal: [default]: UNREACHABLE! => {"changed": false, "msg": "Authentication or permission failure. In some cases, you may have been able to authenticate and did not have permissions on the target directory. Consider changing the remote tmp path in ansible.cfg to a path rooted in \"/tmp\". Failed command was: ( umask 77 && mkdir -p \"` echo ~/.ansible/tmp/ansible-tmp-1565678283.204747-204856165820508 `\" && echo ansible-tmp-1565678283.204747-204856165820508=\"` echo ~/.ansible/tmp/ansible-tmp-1565678283.204747-204856165820508 `\" ), exited with result 1", "unreachable": true} amazon-ebs: fatal: [default]: UNREACHABLE! => {"changed": false, "msg": "Authentication or permission failure. In some cases, you may have been able to authenticate and did not have permissions on the target directory. Consider changing the remote tmp path in ansible.cfg to a path rooted in \"/tmp\". Failed command was: ( umask 77 && mkdir -p \"` echo ~/.ansible/tmp/ansible-tmp-1565678283.204747-204856165820508 `\" && echo ansible-tmp-1565678283.204747-204856165820508=\"` echo ~/.ansible/tmp/ansible-tmp-1565678283.204747-204856165820508 `\" ), exited with result 1", "unreachable": true}2019/08/13 07:38:03 ui: amazon-ebs: to retry, use: --limit @/home/richard/git/ansible/playbooks/windows_image_build/playbook.retry amazon-ebs: to retry, use: --limit @/home/richard/git/ansible/playbooks/windows_image_build/playbook.retry amazon-ebs:2019/08/13 07:38:03 ui: amazon-ebs:2019/08/13 07:38:03 ui: amazon-ebs: PLAY RECAP ********************************************************************* amazon-ebs: PLAY RECAP *********************************************************************2019/08/13 07:38:03 ui: amazon-ebs: default : ok=0 changed=0 unreachable=1 failed=0
amazon-ebs: default : ok=0 changed=0 unreachable=1 failed=0
2019/08/13 07:38:03 ui: amazon-ebs: amazon-ebs:
To unsubscribe from this group and stop receiving emails from it, send an email to packe...@googlegroups.com.
exec request: /bin/sh -c '( umask 77 && mkdir -p "` echo ~/.ansible/tmp/ansible-tmp-1565678283.204747-204856165820508...
amazon-ebs: fatal: [default]: UNREACHABLE! => {"changed": false, "msg": "Authentication or permission failure.
This is interesting - is this related?
This is interesting - is this related?
--
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 packer-tool...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/e13608ae-3040-46e9-a9c1-0faa8e676a51%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to packer-tool...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/7907eeff-6e0d-444c-a2b1-446d92eef894%40googlegroups.com.
{ "variables": { "aws_access_key": "", "aws_secret_key": "" }, "builders": [{ "type": "amazon-ebs", "access_key": "{{user `aws_access_key`}}", "secret_key": "{{user `aws_secret_key`}}", "region": "eu-west-2",
"vpc_id": "vpc-xxxxxxxxxxx", "subnet_id": "subnet-xxxxxxxxxxxx", "source_ami": "ami-xxxxxxxxxxx", "instance_type": "t2.micro", "iam_instance_profile": "packer_builder",
"ami_name": "Windows Core 1809 {{timestamp}}", "user_data_file": "./user_data.ps1", "communicator": "winrm", "winrm_username": "Administrator", "winrm_use_ssl": true, "winrm_insecure": true,
"tags": [ { "windows": "" } ], "launch_block_device_mappings": [{ "delete_on_termination": "true", "device_name": "xvde", "volume_size": 100, "volume_type": "gp2"
}] }], "provisioners": [ { "type": "ansible", "playbook_file": "../playbooks/windows_image_build/playbook.yml", "extra_arguments": [
"--connection", "packer", "--extra-vars", "ansible_shell_type=powershell ansible_shell_executable=None" ] } ] }
<powershell>
#Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled False#Enable-PSRemoting -SkipNetworkProfileCheck -Force
write-output "Running User Data Script"write-host "(host) Running User Data Script"
Set-ExecutionPolicy Unrestricted -Scope LocalMachine -Force -ErrorAction Ignore
# Don't set this before Set-ExecutionPolicy as it throws an error$ErrorActionPreference = "stop"
# Remove HTTP listenerRemove-Item -Path WSMan:\Localhost\listener\listener* -Recurse
Set-Item WSMan:\localhost\MaxTimeoutms 1800000Set-Item WSMan:\localhost\Service\Auth\Basic $true
$Cert = New-SelfSignedCertificate -CertstoreLocation Cert:\LocalMachine\My -DnsName "packer"New-Item -Path WSMan:\LocalHost\Listener -Transport HTTPS -Address * -CertificateThumbPrint $Cert.Thumbprint -Force
# WinRMwrite-output "Setting up WinRM"write-host "(host) setting up WinRM"
cmd.exe /c winrm quickconfig -qcmd.exe /c winrm set "winrm/config" '@{MaxTimeoutms="1800000"}'cmd.exe /c winrm set "winrm/config/winrs" '@{MaxMemoryPerShellMB="1024"}'cmd.exe /c winrm set "winrm/config/service" '@{AllowUnencrypted="true"}'cmd.exe /c winrm set "winrm/config/client" '@{AllowUnencrypted="true"}'cmd.exe /c winrm set "winrm/config/service/auth" '@{Basic="true"}'cmd.exe /c winrm set "winrm/config/client/auth" '@{Basic="true"}'cmd.exe /c winrm set "winrm/config/service/auth" '@{CredSSP="true"}'cmd.exe /c winrm set "winrm/config/listener?Address=*+Transport=HTTPS" "@{Port=`"5986`";Hostname=`"packer`";CertificateThumbprint=`"$($Cert.Thumbprint)`"}"cmd.exe /c netsh advfirewall firewall set rule group="remote administration" new enable=yescmd.exe /c netsh firewall add portopening TCP 5986 "Port 5986"cmd.exe /c net stop winrmcmd.exe /c sc config winrm start= autocmd.exe /c net start winrm
</powershell>
{ "setComputerName": false, "setWallpaper": false, "addDnsSuffixList": false, "extendBootVolumeSize": false, "handleUserData": false, "adminPasswordType": "Random"}
plugin: aws_ec2regions: - eu-west-2 filters: tag:Name: Packer Builder
keyed_groups: - key: tags prefix: '' separator: ""
compose: ansible_host: private_ip_addresshostnames: - network-interface.addresses.private-ip-address
ansible_connection: winrmansible_winrm_transport: ntlmansible_winrm_server_cert_validation: ignoreansible_port: 5986ansible_winrm_scheme: https
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/7907eeff-6e0d-444c-a2b1-446d92eef894%40googlegroups.com.
--Alvaro
To unsubscribe from this group and stop receiving emails from it, send an email to packer-tool...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/8f7d06ae-91a0-4662-8849-63dd7d873e5b%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/8f7d06ae-91a0-4662-8849-63dd7d873e5b%40googlegroups.com.