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:
---
- hosts: app_servers
tasks:
- name: ensure Google Chrome is installed
win_chocolatey:
name: googlechrome
would then fail with the following error:
PLAY [app_servers]
*********************************************************************************************************************************
TASK [Gathering Facts]
*****************************************************************************************************************************
ok: [training-app.vatit.io]
TASK [ensure Google Chrome is installed]
***********************************************************************************************************
fatal: [training-app.vatit.io]: FAILED! => {"changed": false, "command":
"C:\\ProgramData\\chocolatey\\bin\\choco.exe list --local-only --exact
--limit-output googlechrome", "msg": "Error checking installation status
for the package 'googlechrome'", "rc": 2, "stderr": "", "stderr_lines": [],
"stdout": "", "stdout_lines": []}
to retry, use: --limit @/ansible/app_server.retry
PLAY RECAP
*****************************************************************************************************************************************
training-app.vatit.io : ok=1 changed=0 unreachable=0 failed=1
It turns out when you run the command directly on the Windows server
C:\ProgramData\chocolatey\bin\choco.exe list --local-only --exact
--limit-output googlechrome
then it fails with an error code. But it *does not* with earlier versions
of chocolatey.
In order for me to get the playbook to work again, I've uninstalled the
latest version of Chocolatey, and installed a specific version (I find that
version *0.10.11* works for me) by following the instructions
from
https://chocolatey.org/docs/installation#installing-a-particular-version-of-chocolatey.
I also tried the following role
(https://galaxy.ansible.com/deekayen/chocolatey) which helps to install a
specific version.
I don't know if this is an Ansible bug, a Chocolatey bug or something in
between. In my mind, Chocolatey should not return an error when checking if
a package is already installed.
I did spend a fair amount of time debugging this issue, so I hope it is
useful to someone in the same situation as me.
Cheers,
Guillaume.
--
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/c4838a54-e0ca-43bb-83b3-1226ee6de984%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.