Hello,
I’m trying to use Ansible as a provisioner with Packer. I have a playbook with tasks that:
-create a local directory (win_file)
-download a file from s3 (aws_s3)
-run windows updates (win_updates)
It works fine when I run it manually, but when I run it from Packer (Ansible provisioner), the only Task that works is the one to create a local directory. The other Tasks fail with generic error: “msg”: "Unexpected failure during module execution.
Is there a limit to which modules will work with Packer?
Is there something special you need to do to make the modules work? I’m pretty new to Ansbile – thanks much for any help
- hosts: all
tasks:
- name: Create a directory
win_file:
path: C:\updater
state: directory
- name: download chocolatey from s3 to control host
vars:
ansible_python_interpreter: /usr/bin/python3
aws_s3:
bucket: launch-data
object: chocolatey.0.10.13.nupkg
dest: /home/ec2-user/chocolatey.0.10.13.nupkg
mode: get
delegate_to: localhost
- name: copy chocolatey from control host to target host updater folder
win_copy:
src: /home/ec2-user/chocolatey.0.10.13.nupkg
dest: C:\updater\chocolatey.0.10.13.nupkg
- name: run windows update
win_updates:
category_names:
-
CriticalUpdates
-
SecurityUpdates
state: installed
register: update_result
- name: reboot host if required after updates
win_reboot:
when: update_result.reboot_required