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

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/971d5c02-3dc7-4d90-a0ca-eddcf991e52a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to