ansible-collections / community.zabbix

Zabbix Ansible modules
http://galaxy.ansible.com/community/zabbix
Other
315 stars 265 forks source link

Fix zabbix_agent role on Windows #1290

Open emrocha opened 2 weeks ago

emrocha commented 2 weeks ago
SUMMARY

Role zabbix_agent is not working on Windows.

ISSUE TYPE
COMPONENT NAME

Role zabbix_agent

ADDITIONAL INFORMATION
david-sieg commented 6 days ago

Are there any news here?

the-iot commented 6 days ago

the agent role is fixed by commit b0f05b4 but the version 3.0.1 is not released.

see https://github.com/ansible-collections/community.zabbix/pull/1301#event-13250962392

emrocha commented 4 days ago

I was a little busy this week, but I will take a look soo n.

emrocha commented 1 day ago

the agent role is fixed by commit b0f05b4 but the version 3.0.1 is not released.

see #1301 (comment)

The code below in zabbix_agent role still include the role zabbix_repo for Windows hosts.

https://github.com/ansible-collections/community.zabbix/blob/28c4921182f45fe0f16796bbb496b1d95016f316/roles/zabbix_agent/tasks/main.yml#L43-L52

In my view, the correct logic in the "when" statement shoud be:

 when:
    - zabbix_manage_repo | default(true)
    - not (zabbix_agent_docker | bool)
    - ansible_os_family != "Windows"

In the role zabbix_repo, the code below tries to load the Windows.yml file that do not exists in role zabbix_repo.

https://github.com/ansible-collections/community.zabbix/blob/28c4921182f45fe0f16796bbb496b1d95016f316/roles/zabbix_repo/tasks/main.yml#L7-L8

For this reason, the script still does not work for Windows Hosts.

david-sieg commented 1 day ago

Yes mate, you're right. Can u open a PR?

emrocha commented 1 day ago

@david-sieg I made the correction in the "when" statement for the "Install Repository" task now. But a keep it in this pull request that include others changes. Is the ok for you?

@pyrodie18

I remove some "zabbix2_*" variables. But not all. The code below is necessary because the script tries to remove old versions and need to test both zabbix agents (1 and 2).

https://github.com/ansible-collections/community.zabbix/blob/28c4921182f45fe0f16796bbb496b1d95016f316/roles/zabbix_agent/tasks/Windows.yml#L28-L35

david-sieg commented 1 day ago

That‘s ok for me, thx!

the-iot commented 17 hours ago

please add merge into main and release 3.0.2 - momentary we cant install zabbix agent on windows with release 3.x

pyrodie18 commented 10 hours ago

OK, this looks good to me. The only thing still needed is change fragment(s).