-
Notifications
You must be signed in to change notification settings - Fork 259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
unable to connect to socket error while running task for multiple server #1112
Comments
Not sure I totally follow what you mean by use it for a group of servers. |
@pyrodie18 i have in my hosts file a group called proxmox_servers where are 6 server assigned. When I start the playbook with the --limit proxmox_servers the problem occurs. |
As I read the output of the error (granted I'm not an expert), I don't see it even trying to execute the module, but instead failing trying to connect to the host. I suspect (again, a bit of a guess) that because you're delegating to |
@solick did you try to follow these steps as failure message suggests |
Any feedback @solick ? |
@pyrodie18 @BGmot sorry für my late response. I was very busy the last weeks. I will try to troubleshoot within the next days and will than give feedback. |
I have the same problem after migration to the new connect method. out of 10 server, maybe 2 goes ok |
Looks like it runs it multiple time on each host. This is the web log for 11 hosts zabbix: 6.2
PLAY RECAP **************************************************************************************************
RANDOMSERVERNAME1.net : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
RANDOMSERVERNAME2.net : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
RANDOMSERVERNAME3.net : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
RANDOMSERVERNAME4.net : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
RANDOMSERVERNAME5.net : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
RANDOMSERVERNAME6.net : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
RANDOMSERVERNAME7.net : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
RANDOMSERVERNAME8.net : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
RANDOMSERVERNAME9.net : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
RANDOMSERVERNAME10.net : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
RANDOMSERVERNAME11.net : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 - name: Zabbix | Create a new host or update an existing host's info
vars:
gather_facts: false
ansible_network_os: community.zabbix.zabbix
ansible_connection: httpapi
ansible_httpapi_port: 80
ansible_httpapi_use_ssl: false
ansible_httpapi_validate_certs: false
ansible_zabbix_url_path: ''
ansible_zabbix_auth_key: "{{ secure_zabbix_api_token }}"
become: false
delegate_to: "{{ secure_zabbix_host_url }}"
community.zabbix.zabbix_host:
host_name: "{{ inventory_hostname }}"
host_groups:
- 'Linux servers'
link_templates: "{{ zabbix_link_templates }}"
interfaces:
- type: 'agent'
main: 1
useip: 0
dns: "{{ inventory_hostname }}"
some fail with it's not isolated to one host, HOST1.net : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
HOST2.net : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
HOST3.net : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
HOST4.net : ok=1 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
HOST5.net : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
HOST6.net : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
HOST7.net : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
HOST8.net : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
HOST9.net : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
HOST10.net : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
HOST11.net : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
HOST1.net : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
HOST2.net : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
HOST3.net : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
HOST4.net : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
HOST5.net : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
HOST6.net : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
HOST7.net : ok=1 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
HOST8.net : ok=1 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
HOST9.net : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
HOST10.net : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
HOST11.net : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 |
One execution of zabbix_host module (and almost all modules) involves multiple API calls, I believe this is what you are seeing not several execution of zabbix_host on each server. |
Hi, For everyone else, fixed it by using version 1.9.3 requirements.yamlcollections:
- name: community.zabbix
version: 1.9.3 |
Hi,
I performed a tcpdump on the Zabbix server and saw that in the “Host:” header the IP address was indicated instead of the host name.
I process all such requests in NGINX with I think if you remove the conversion of the host name to IP address, the problem will be solved. |
Same issue with version 2.3.1. The task will randomly fail on some hosts when executing against a group. When running the task against the hosts one by one, not against the group, it finishes successfully every time. Zabbix Server is 6.4.2 Edit: looks like this might be related. |
Finally got time to investigate this interesting problem. Cannot reproduce.
Tested with much newer version of Ansible/Python too:
Collection version is 2.3.1. My inventory:
My playbook:
Running:
And in WebUI I see all the hosts successfully added. |
Hey @BGmot, after some tests we discovered that the issue, at least for us, is mostly happening when running the playbooks on macOS. Running the same on Linux works just fine. |
Bingo! On MacOS it fails indeed. On Ubuntu running without any problems. The same versions of Ansible + Python. |
Also on MacOS here System Software Overview:
|
+1 |
Since it sounds like this is definitely a problem with Ansible and not the collection, I'm going to close this out and encourage someone to open a ticket in the Ansible project. |
Hello @pyrodie18 ! Can you elaborate on how you came to the conclusion that this issue is with Ansible rather than the zabbix module? Could it not be an interaction with this module specifically and MacOS? m! |
HttpAPI connection plugin is provided by Ansible, our modules just use it. The issue is not happening on Linux OS. Do you have any idea how we can troubleshoot this? I am all for it but don't know how to approach it. |
SUMMARY
Running a task against one server is working, running it against a server group cause "unable to connect to socket" error
ISSUE TYPE
COMPONENT NAME
community.zabbix.zabbix_hostmacro:
ANSIBLE VERSION
CONFIGURATION
OS / ENVIRONMENT / Zabbix Version
Zabbix 6.0
MacOS 17.1
STEPS TO REPRODUCE
Set macros via zabbix_hostmacro module.
Use the tasks for a single server is working, use the task for a group of servers is not working.
EXPECTED RESULTS
The task should be able to run against a group of servers without error.
ACTUAL RESULTS
The error does not occur for all servers (I tested with a group of 6 servers) but occurs for part of them.
The text was updated successfully, but these errors were encountered: