ansible-collections / community.zabbix

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

Help request: incorporating into patching routine breaks connections to hosts (httpapi?) #1020

Closed svensol closed 1 year ago

svensol commented 1 year ago

Hi All, please close and forward me to the right place to raise this.

I have a patching routine in AAP2.3 that runs against groups of servers. I want(ed) to add in a step that creates a maintenance period into the run, stopping the need to manually go and create them.

Unfortunately, setting:

in the role defaults goes against the inventory that's passed and it's stops working. Ideally a variable to specify the zabbix server, but the "server_url" is deprecated and is using the "httpapi" connection method and I'm not sure how to go about using this correctly.

Running the code by itself works a treat. I pass my own inventory files, groups, etc, all works. It logs into Zabbix, creates the maintenance period, adds the hosts, even adds a CSV list into the description of the host groups that are passed.

Changing the host/connection stops the rest of the role from working correctly.

Unless I'm fundamentally wrong here. Any help is appreciated (or directing me to where I can get the help)

Here's an approximation of the code structures:

patch-servers.yml /collections/requirements.yml /inventory/group1 /inventory/group2 /roles/upgrade-all/ /roles/upgrade-all/defaults/main.yml /roles/upgrade-all/tasks/ /roles/upgrade-all/tasks/01-os-vars.yml /roles/upgrade-all/tasks/05-setup-reporting.yml /roles/upgrade-all/tasks/10-create-zabbix-period.yml /roles/upgrade-all/tasks/20-yum-update.yml /roles/upgrade-all/tasks/30-finish.yml /roles/upgrade-all/tasks/main.yml /roles/upgrade-all/templates/report.j2 /roles/upgrade-all/vars/RedHat/7.yml /roles/upgrade-all/vars/RedHat/8.yml /roles/upgrade-all/vars/RedHat/9.yml

shk3bq4d commented 1 year ago

Hello!

Have you tried setting the ansible_host at the task(s) vars level ?

Best regards,