Closed tobiasehlert closed 4 years ago
I think this could be related to following.. https://github.com/ansible/ansible/issues/65304
Hi @tobiasehlert Have you tried using a newer version of Ansible to solve this issue?
Hi @dj-wasabi,
I've upgraded to following version:
ansible 2.9.5
config file = /etc/ansible/ansible.cfg
configured module search path = ['/home/tobias/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3.6/site-packages/ansible
executable location = /usr/bin/ansible
python version = 3.6.8 (default, Nov 21 2019, 19:31:34) [GCC 8.3.1 20190507 (Red Hat 8.3.1-4)]
Here is the latest stack trace on this..
The full traceback is:
Traceback (most recent call last):
File "/root/.ansible/tmp/ansible-tmp-1583395986.5052142-98721871607287/AnsiballZ_zabbix_host.py", line 114, in <module>
_ansiballz_main()
File "/root/.ansible/tmp/ansible-tmp-1583395986.5052142-98721871607287/AnsiballZ_zabbix_host.py", line 106, in _ansiballz_main
invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
File "/root/.ansible/tmp/ansible-tmp-1583395986.5052142-98721871607287/AnsiballZ_zabbix_host.py", line 49, in invoke_module
imp.load_module('__main__', mod, module, MOD_DESC)
File "/usr/lib64/python3.6/imp.py", line 235, in load_module
return load_source(name, filename, file)
File "/usr/lib64/python3.6/imp.py", line 170, in load_source
module = _exec(spec, sys.modules[name])
File "<frozen importlib._bootstrap>", line 618, in _exec
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/tmp/ansible_zabbix_host_payload_bm7p5trw/__main__.py", line 857, in <module>
File "/tmp/ansible_zabbix_host_payload_bm7p5trw/__main__.py", line 817, in main
File "/tmp/ansible_zabbix_host_payload_bm7p5trw/__main__.py", line 502, in check_all_properties
KeyError: 'inventory_mode'
fatal: [psg1-lobbymirror-001.home -> localhost]: FAILED! => {
"attempts": 3,
"changed": false,
"module_stderr": "Traceback (most recent call last):\n File \"/root/.ansible/tmp/ansible-tmp-1583395986.5052142-98721871607287/AnsiballZ_zabbix_host.py\", line 114, in <module>\n _ansiballz_main()\n File \"/root/.ansible/tmp/ansible-tmp-1583395986.5052142-98721871607287/AnsiballZ_zabbix_host.py\", line 106, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/root/.ansible/tmp/ansible-tmp-1583395986.5052142-98721871607287/AnsiballZ_zabbix_host.py\", line 49, in invoke_module\n imp.load_module('__main__', mod, module, MOD_DESC)\n File \"/usr/lib64/python3.6/imp.py\", line 235, in load_module\n return load_source(name, filename, file)\n File \"/usr/lib64/python3.6/imp.py\", line 170, in load_source\n module = _exec(spec, sys.modules[name])\n File \"<frozen importlib._bootstrap>\", line 618, in _exec\n File \"<frozen importlib._bootstrap_external>\", line 678, in exec_module\n File \"<frozen importlib._bootstrap>\", line 219, in _call_with_frames_removed\n File \"/tmp/ansible_zabbix_host_payload_bm7p5trw/__main__.py\", line 857, in <module>\n File \"/tmp/ansible_zabbix_host_payload_bm7p5trw/__main__.py\", line 817, in main\n File \"/tmp/ansible_zabbix_host_payload_bm7p5trw/__main__.py\", line 502, in check_all_properties\nKeyError: 'inventory_mode'\n",
"module_stdout": "",
"msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
"rc": 1
}
Hi @tobiasehlert
Then we probably need to create an issue on the Ansible project for this. Which module is screaming with this stacktrace? (zabbix_host
?)
Hi @dj-wasabi
It's the zabbix_host module that is not happy and returns the stacktrace. :)
Create issue at Ansible: https://github.com/ansible/ansible/issues/68088
Hi @tobiasehlert
Can you take a look at PR https://github.com/ansible/ansible/pull/66860 and see if this change works for you?
Hi @dj-wasabi,
I just install the application using DNF on CentOS.. how am I supposed to install the correct patched version?
Hi @dj-wasabi,
I just install the application using DNF on CentOS.. how am I supposed to install the correct patched version?
I was having the same problem. Downloaded the zabbix_host module from here. Put it in ~/.local/lib/python2.7/site-packages/ansible/modules/monitoring/zabbix/
, but that may be something like /usr/local/lib/python2.7/dist-packages/ansible/modules/monitoring/zabbix
, depends on your setup. Removed zabbix_host.pyc and executed python -m compileall .
in the containing directory. Ran the playbook again and it worked.
I'm not familiar with python so there may be simpler steps to achieve the same goal. Perhaps using the library
folder.
I'm running ansible version 2.9.6.
Hi @tobiasehlert
What I do, is configure the library
in the ansible.cfg
file: https://docs.ansible.com/ansible/2.4/intro_configuration.html#library
I manually copy the patched file from github into this directory and run the role.
Hi @dj-wasabi,
I've downloaded the zabbix_host.py file from https://raw.githubusercontent.com/ansible/ansible/9110fa9ea7311f0a67cfe3e2794c7e238213a369/lib/ansible/modules/monitoring/zabbix/zabbix_host.py and placed it in /usr/lib/python3.6/site-packages/ansible/modules/monitoring/zabbix
After that I run python -m compileall .
just as @frock81 did it, and then I re-run my playbook with the role and I still receive the stack-trace..
The full traceback is:
Traceback (most recent call last):
File "/root/.ansible/tmp/ansible-tmp-1584998644.2186158-197239467383549/AnsiballZ_zabbix_host.py", line 114, in <module>
_ansiballz_main()
File "/root/.ansible/tmp/ansible-tmp-1584998644.2186158-197239467383549/AnsiballZ_zabbix_host.py", line 106, in _ansiballz_main
invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
File "/root/.ansible/tmp/ansible-tmp-1584998644.2186158-197239467383549/AnsiballZ_zabbix_host.py", line 49, in invoke_module
imp.load_module('__main__', mod, module, MOD_DESC)
File "/usr/lib64/python3.6/imp.py", line 235, in load_module
return load_source(name, filename, file)
File "/usr/lib64/python3.6/imp.py", line 170, in load_source
module = _exec(spec, sys.modules[name])
File "<frozen importlib._bootstrap>", line 618, in _exec
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/tmp/ansible_zabbix_host_payload_84maim7t/__main__.py", line 857, in <module>
File "/tmp/ansible_zabbix_host_payload_84maim7t/__main__.py", line 817, in main
File "/tmp/ansible_zabbix_host_payload_84maim7t/__main__.py", line 502, in check_all_properties
KeyError: 'inventory_mode'
Regards, Tobias
I've downloaded the zabbix_host.py file from https://raw.githubusercontent.com/ansible/ansible/9110fa9ea7311f0a67cfe3e2794c7e238213a369/lib/ansible/modules/monitoring/zabbix/zabbix_host.py and placed it in
/usr/lib/python3.6/site-packages/ansible/modules/monitoring/zabbix
Perhaps you could try to follow @dj-wasabi's suggestion. Setup library
ini key in ansible.cfg
(https://docs.ansible.com/ansible/latest/reference_appendices/config.html#default-module-path) and put the module patched in there.
This may help you.
To use a local module only in certain playbooks:
store it in a sub-directory called library in the directory that contains the playbook(s)
To use a local module only in a single role:
store it in a sub-directory called library within that role
Hi @tobiasehlert
Where you able to test it? This repository will be "closed" soon as this role will be transferred to a collection. After that, this role will be read-only available and thus any other changes will be made into the collection.
Hi @dj-wasabi,
Yes, I managed to get the library path working and can confirm that the playbook is running successful.
TASK [dj-wasabi.zabbix-agent : Create a new host or update an existing host's info] *****************************************************************************************************************************************************
ok: [XXX.com -> localhost]
ok: [XXY.com -> localhost]
So the PR https://github.com/ansible/ansible/pull/66860 works fine for me :)
Regards, Tobias
@tobiasehlert
Nice! Thanks! 👍
Describe the bug
I have created a simple playbook that points to the role dj-wasabi.zabbix-agent, which is installed by AWX on the flight. The playbook has worked earlier (two days ago) and not it doesn't work anymore.
I receive following issue, when running the playbook on my ansible server (towards every host).
Installation method/version I used this guide from the start: https://www.linuxtechi.com/install-ansible-awx-docker-compose-centos-8/
So basically running Ansible AWX inside docker on CentOS 8.
My roles requirements file in my playbook:
Ansible Version
Targetted hosts Concerns the following OS(es):
Expected behavior That it should not fail.
Additional context These are the vars that are on the group all.