Hello everyone I'm working on a azure-rm build out with a combination of Ansible and powershell provisioners. I'm fairly new to packer and part of my issue might just be mu lack of understanding. I'm able to build and capture the below json as long as it doesn't contain the ansible provisioner. Once i include the ansible playbook it run through my ansible plays then closed the SSH connection. is there a way to run through my ansible provisioner and still runs the powershell to sysprep the machine after?
packer-powershell-provisioner693266562 log if( Test-Path $Env:SystemRoot\windows\system32\Sysprep\unattend.xml ){ rm $Env:SystemRoot\windows\system32\Sysprep\unattend.xml -Force} & $Env:SystemRoot\System32\Sysprep\Sysprep.exe /oobe /generalize /shutdown /quiet "builders": [{ "type": "azure-arm", "client_id": "", "client_secret": "", "tenant_id": "", "subscription_id": "", "object_id": "", "managed_image_resource_group_name": "core-images", "managed_image_name": "20166-CIS-image", "os_type": "Windows", "image_publisher": "MicrosoftWindowsServer", "image_offer": "WindowsServer", "image_sku": "2016-Datacenter", "communicator": "winrm", "winrm_use_ssl": "true", "winrm_insecure": "true", "winrm_timeout": "45m", "winrm_username": "packer", "azure_tags": { "dept": "Engineering", "task": "Image deployment" }, "location": "east US", "vm_size": "Standard_DS2_v2" }], "provisioners": [ { "type": "windows-shell", "inline": ["dir c:\\wsa"] }, { "type": "ansible", "playbook_file": "main.yml", "extra_arguments": [ "--connection", "packer", "--extra-vars", "ansible_shell_type=powershell ansible_shell_executable=None" ] }, { "type": "powershell", "inline": [ "Add-WindowsFeature Web-Server", "if( Test-Path $Env:SystemRoot\\windows\\system32\\Sysprep\\unattend.xml ){ rm $Env:SystemRoot\\windows\\system32\\Sysprep\\unattend.xml -Force}", "& $Env:SystemRoot\\System32\\Sysprep\\Sysprep.exe /oobe /generalize /shutdown /quiet" ] } -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/d6ff57cc-f422-4af0-bff0-74dd22cecf3a%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.