{ "type": "ansible", "playbook_file": "poc-base-image-playbook/main.yml", "extra_arguments": [ "--connection", "packer", "--extra-vars", "ansible_shell_type=powershell ansible_shell_executable=None" ]}{ "type": "powershell", "inline": [ "\"[{{build_name}}]\" > C:\\Windows\\Temp\\host", "switch -Wildcard ($env:PACKER_BUILDER_TYPE) {", " \"amazon*\" { $publicipv4 = Invoke-WebRequest -Uri http://169.254.169.254/latest/meta-data/public-ipv4", " $publicipv4.Content >> C:\\Windows\\Temp\\host }", " \"azure*\" { $publicipv4 = Invoke-WebRequest -Uri \"http://169.254.169.254/metadata/instance/network/interface/0/ipv4/ipAddress/0/publicIpAddress?api-version=2017-12-01&format=text\"", " $publicipv4.Content >> C:\\Windows\\Temp\\host }", " \"googlecompute\" { $publicipv4 = Invoke-WebRequest -Uri http://metadata.google.internal/computeMetadata/v1/instance/network-interfaces/0/access-configs/0/external-ip -Headers @{\"Metadata-Flavor\" = \"Google\"}", " [system.Text.Encoding]::UTF8.GetString($publicipv4.RawContentStream.ToArray()) >> C:\\Windows\\Temp\\host }", " Default { Throw \"Unknown PACKER_BUILDER_TYPE\" }", "}" ]},{ "type": "file", "direction": "download", "source": "C:\\Windows\\Temp\\host", "destination": "poc-base-image-playbook/{{build_name}}-host"},{ "type": "shell-local", "inline": [ "export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES", "case \"$PACKER_BUILDER_TYPE\" in", " amazon*) ANSIBLE_USER={{user `aws_winrm_user`}};;", " azure*) ANSIBLE_USER={{user `azure_winrm_user`}};;", " googlecompute) ANSIBLE_USER={{user `gcp_winrm_user`}};;", "esac", "dos2unix poc-base-image-playbook/{{build_name}}-host", "ansible-playbook -v -i poc-base-image-playbook/{{build_name}}-host --extra-vars \"ansible_user=$ANSIBLE_USER ansible_password={{.WinRMPassword}} ansible_become_pass={{.WinRMPassword}} ansible_port=5986 ansible_connection=winrm ansible_winrm_server_cert_validation=ignore\" poc-base-image-playbook/main.yml" ]},--
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/1026dc0e-0a6f-46eb-9f36-383d5807303c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Awesome thanks! I’ve decided to go with shell-local provisioner vs ansible to use native WinRM vs the custom connection. I like how you build the logic into the playbook for all the cloud providers – I’m gonna steal that part 😃
Ben
You received this message because you are subscribed to a topic in the Google Groups "Packer" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/packer-tool/Qr53-eYdVT0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to packer-tool...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/CANh5szof5W_M9mXwDn6D%2Bf54vXKbEX9_1m%2Bk%3DMHxZO2L93tYfA%40mail.gmail.com.