Ansible issue with Windows and Chocolatey 0.10.13

Hi all,

I use Ansible to deploy Chocolatey packages on Windows Server 2016 machines (hosted on Amazon EC2). Yesterday, I re-created a brand new cluster for training purposes and I attempted to re-deploy my applications on it from scratch.

I’ve done this process countless times but yesterday it started to fail even though the playbooks had not changed in a while. After a fair amount of debugging, I found out that the error is caused by Chocolatey version 0.10.13.

Because the EC2 instances were created yesterday (24/03/2019), version 0.10.13 is the version that Ansible installed when it invoked the win_chocolatey command the 1st time around.

A playbook as simple as:
`

This is a known issue and is due to a breaking change on Chocolatey’s end in the 0.10.12 release. See https://github.com/ansible/ansible/issues/53860#issuecomment-473431360 for more details.

Thanks

Jordan

Hi,

Thanks for the link, I wonder why I did not find it the 1st time around.

I was initially using Ansible 2.4.x and the error message was very obscure, so the issue became more obvious when I tried Ansible 2.7.x.

Thanks for your help.

Guillaume.

Jordan,

Is it possible in a configuration file to specify the version of chocolatey to install?

Thanks

Jason

Not something I’ve tested but if you are installing it from the public repo and not some internal repository you might be able to set the ‘chocolateyVersion’ environment variable as documented by https://chocolatey.org/install#installing-a-particular-version-of-chocolatey. This can be done with;

`

  • win_chocolatey:
    name: chocolatey
    state: present
    environment:
    chocolateyVersion: ‘0.10.11’

`

This isn’t something I’ve tested to prove it works so you would just have to try it and see how it goes. The alternative option is to use an internal repo and don’t add the latest Chocolatey version nupkg and source it from there.

Thanks

Jordan

Hi Jordan,

I’ve just tried the approach that you suggested and it worked for me.

Thanks for the tip.

Guillaume.