Unable to install local package with win_chocolatey

Hello,

I am able to manually install this package from the command line on the windows host like this:
choco install C:\updater\GoogleChrome-AllUsers.26.0.1410.64.nupkg

But I’m not able to do it using the win_chocolatey module from a playbook:
win_chocolatey:
name: GoogleChrome-AllUsers
source: C:\updater\GoogleChrome-AllUsers.26.0.1410.64.nupkg

I’ve tried a couple different versions of the above syntax, but the error is always the same:
“Error checking installation status for the package GoogleChrome-AllUsers”

In the win_chocolatey documentation is says you can use “a path to a folder” for source, but it does not seem to work. I guess I could just use the win_command module instead, but I want to get some feedback before I abandon win_chocolatey. Thanks much for any help.

I have not personally used the win_chocolatey module but here are some of the things I would try

  1. Enable verbose logging with -vvvvv when running with ansible-playbook
  2. Try adding one or more of the following to the win_chocolatey module like this

win_chocolatey:
name: GoogleChrome-AllUsers
source: C:\updater\GoogleChrome-AllUsers.26.0.1410.64.nupkg

become: yes
become_user: Administrator
become_method: runas

I suspect when you run on the command line, you have adminstrator previlege. But the user ansible uses does not.

You can try to use the win_command module to see if you can get it to work to rule out permission issue but I suspect you will run into similar issue.

For more information on Privilege Escalation, see
https://docs.ansible.com/ansible/latest/user_guide/become.html

–Tony Chia

This is a known issue with the recent release of Chocolatey, https://github.com/ansible/ansible/issues/53860#issuecomment-473431360.