Skip to content
This repository has been archived by the owner on Jul 31, 2020. It is now read-only.

ansible-zabbix-agent fails on Unzip on Windows with Ansible 2.9.x #291

Closed
rnsc opened this issue Dec 5, 2019 · 8 comments
Closed

ansible-zabbix-agent fails on Unzip on Windows with Ansible 2.9.x #291

rnsc opened this issue Dec 5, 2019 · 8 comments
Labels
documentaion A documentation issue

Comments

@rnsc
Copy link
Contributor

rnsc commented Dec 5, 2019

Describe the bug

I have the following issue with Ansible 2.9.1 and zabbix-agent 2.1.0 (Ansible Galaxy):

failure: Error unzipping 'c:\zabbix\\zabbix_agents-4.0.0-win-amd64.zip' to 'c:\zabbix\'!. Method: System.IO.Compression.ZipFile, Exception: Exception calling "Open" with "3" argument(s): "End of Central Directory record could not be found."
{
"changed": false,
"dest": "c:\\zabbix\\",
"msg": "Error unzipping 'c:\\zabbix\\\\zabbix_agents-4.0.0-win-amd64.zip' to 'c:\\zabbix\\'!. Method: System.IO.Compression.ZipFile, Exception: Exception calling \"Open\" with \"3\" argument(s): \"End of Central Directory record could not be found.\"",
"removed": false,
"src": "c:\\zabbix\\\\zabbix_agents-4.0.0-win-amd64.zip"
}

This happens on this task:

Description[w19-m32-zab466] converge: dj-wasabi.zabbix-agent : windows | unzip file src={{ zabbix win install dir }}\{{ zabbix win package }}, dest={{ zabbix win install dir }}, creates={{ zabbix win exe path }}
Test class/tmp/zabbix/roles/dj-wasabi.zabbix-agent/tasks/Windows.yml:114

Installation method/version

Ansible Version

ansible 2.9.1
  config file = None
  configured module search path = ['/home/molecule/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.8/site-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 3.8.0 (default, Nov 23 2019, 05:36:56) [GCC 8.3.0]

Targetted hosts
Concerns the following OS(es):

  • Windows

Expected behavior

I have no issues on Ansible 2.8. So something must have changed, but I didn't see anything in the Porting Guide for 2.9 in that regard.

@rnsc
Copy link
Contributor Author

rnsc commented Dec 5, 2019

I'll try to investigate this a bit more, as I know the Windows support is best effort! :)
I created the ticket for tracking purposes.

@rnsc
Copy link
Contributor Author

rnsc commented Dec 5, 2019

Ok, I tracked down the issue to the fact that the URL I'm using to download the package contains a redirect (302, Moved permanently).
win_get_url in Ansible 2.9 has a bunch of new parameters introduced.
"follow_redirects" is one of them. "safe" is the default option, meaning it should follow redirects on GET requests.

Now, it does look like the win_get_url operation, is only downloading the HTTP response (372 bytes) instead of following the redirect to download.
So it means it's not following the redirect to download the target file.

I'll investigate a bit more.

@rnsc
Copy link
Contributor Author

rnsc commented Dec 5, 2019

So using "follow_redirects: all" on the download task is the approach.
Now, I need to check if it's retro-compatible with Ansible 2.8/2.7 :) (it's not)

@rnsc
Copy link
Contributor Author

rnsc commented Dec 5, 2019

I opened a bug report with Ansible: ansible/ansible#65556

@rnsc
Copy link
Contributor Author

rnsc commented Dec 6, 2019

I'll close this, as this is clearly an Ansible issue that's going to be fixed in 2.9.3.
Might want to make it clear in the README of the role that 2.9.{0,1,2} are not compatible. :)

@rnsc rnsc closed this as completed Dec 6, 2019
@dj-wasabi dj-wasabi added the documentaion A documentation issue label Dec 6, 2019
@dj-wasabi dj-wasabi reopened this Dec 6, 2019
@dj-wasabi
Copy link
Owner

Hi @rnsc

I've reopened this issue so I know that I need to update the documentation. Thank you for providing comments and a solution/workaround. 👍

@dj-wasabi
Copy link
Owner

Documented it.

@rnsc
Copy link
Contributor Author

rnsc commented Jan 21, 2020

@dj-wasabi FYI, Ansible 2.9.3 was released a few days ago fixing the mentioned issue. :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentaion A documentation issue
Projects
None yet
Development

No branches or pull requests

2 participants