Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

please use other way to implement the actions in packer hyper-v builder ansible provisioner #34

Open
fsdrw08 opened this issue Sep 2, 2021 · 2 comments

Comments

@fsdrw08
Copy link

fsdrw08 commented Sep 2, 2021

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.

provisioner "ansible" {

@fsdrw08 fsdrw08 changed the title please use other way to implement the actions in hyper-v builder ansible provisioner please use other way to implement the actions in packer hyper-v builder ansible provisioner Sep 2, 2021
@ezamriy
Copy link
Contributor

ezamriy commented Sep 3, 2021

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.

@bbaassssiiee
Copy link

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"
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants