cloud-images
cloud-images copied to clipboard
please use other way to implement the actions in packer hyper-v builder ansible provisioner
As we know, Hyper-V is for windows only, and currently ansible is not able to run natively on windows. So please consider use other way to implement the actions in hyper-v builder ansible provisioner
thanks.
https://github.com/AlmaLinux/cloud-images/blob/addbb0226565d6b5ef450f4e5809c7aed57338fb/almalinux-8-vagrant.pkr.hcl#L147
Actually, it works on top of WSL if you create a few bat/powershell wrappers for ansible commands and add a few hacks to a Packer template.
Our official Azure image https://azuremarketplace.microsoft.com/en-us/marketplace/apps/almalinux.almalinux has been built on Windows using Ansible as the provisioner.
I need some time to polish my configs and write Windows-releated documentation before submitting it to this repo, will close that ticket when I'm done with it.
An alternative could be:
provisioner "shell" {
execute_command = "echo 'vagrant' | {{ .Vars }} sudo -S -E bash '{{ .Path }}'"
scripts = ["scripts/ansible.sh"]
}
provisioner "ansible-local" {
extra_arguments = ["--extra-vars", "ansible_python_interpreter=/usr/bin/python3"]
galaxy_file = "./ansible/roles/requirements.yml"
playbook_dir = "./ansible"
playbook_file = "./ansible/packer-playbook.yml"
}