# Ansible zabbix module issues

**URL:** <https://forum.ansible.com/t/ansible-zabbix-module-issues/26552>\
**Category:** Ansible Project\
**Created:** [January 24, 2018, 6:52am UTC](https://forum.ansible.com/t/ansible-zabbix-module-issues/26552 "2018-01-24T06:52:56Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andrew\_Morgan2](https://avatars.discourse-cdn.com/v4/letter/a/6bbea6/32.png) [@Andrew\_Morgan2](https://forum.ansible.com/u/Andrew_Morgan2)\
**Post date:** [January 24, 2018, 6:52am UTC](https://forum.ansible.com/t/ansible-zabbix-module-issues/26552/1 "2018-01-24T06:52:56Z")

</div>

Hello All,

My ansible module is

`

ansible 2.4.2.0  
config file = /ansible/ansible.cfg  
configured module search path = [u’/root/.ansible/plugins/modules’, u’/usr/share/ansible/plugins/modules’]  
ansible python module location = /usr/lib/python2.6/site-packages/ansible  
executable location = /usr/bin/ansible  
python version = 2.6.6 (r266:84292, Aug 18 2016, 15:13:37) [GCC 4.4.7 20120313 (Red Hat 4.4.7-17)]

`

my play is

- hosts: zabbix

`

tasks:

- name: This is installation  
zabbix\_maintenance:  
name: Zabbix123  
host\_groups: Discovered host,Linux servers  
state: present  
minutes: 90  
server\_url: [http://zabbix.socialpatrol.net](http://zabbix.socialpatrol.net)  
login\_user: Admin  
login\_password: yORKKEI1!  
desc: Setting up maintenance window for builds

`

my issue is that when I try to run ansible-playbook playbook.yaml

I keep getting the error:

`  
TASK [This is installation] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
fatal: [zabbix\_server]: FAILED! =\> {“changed”: false, “msg”: “Missing required zabbix-api module (check docs or install with: pip install zabbix-api)”}  
to retry, use: --limit @/ansible/playbook.retry

`

I have installed pip zabbix-api , zabbix\_api, pyzabbix and neither works. I have even tried installing them to the targe directory ansible has as python module location `/usr/lib/python2.6/site-packages/ansible`  
`but I still get that error.Can someone please help.`

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [January 24, 2018, 7:38am UTC](https://forum.ansible.com/t/ansible-zabbix-module-issues/26552/2 "2018-01-24T07:38:42Z")

</div>

In the documentation[1] is says  
"Requirements (on host that executes module)"

So you need to install it on the remote host, zabbix\_server in your case. so just add this task to you play

- name: Install requirement  
&nbsp;&nbsp;&nbsp;pip:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;name: zabbix-api

[1] [http://docs.ansible.com/ansible/latest/zabbix\_maintenance\_module.html](http://docs.ansible.com/ansible/latest/zabbix_maintenance_module.html)

---

<div class="post-metadata">

**Author:** ![Andrew\_Morgan](https://avatars.discourse-cdn.com/v4/letter/a/50afbb/32.png) [@Andrew\_Morgan](https://forum.ansible.com/u/Andrew_Morgan)\
**Post date:** [January 25, 2018, 12:10am UTC](https://forum.ansible.com/t/ansible-zabbix-module-issues/26552/3 "2018-01-25T00:10:11Z")

</div>

Ok, thank you, can you please send me where that documentation is, the main document I read said nothing like that  
[http://docs.ansible.com/ansible/latest/zabbix\_maintenance\_module.html](http://docs.ansible.com/ansible/latest/zabbix_maintenance_module.html)

Thank you

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [January 25, 2018, 6:48am UTC](https://forum.ansible.com/t/ansible-zabbix-module-issues/26552/4 "2018-01-25T06:48:09Z")

</div>

It does, look at the third heading  
[http://docs.ansible.com/ansible/latest/zabbix\_maintenance\_module.html#requirements-on-host-that-executes-module](http://docs.ansible.com/ansible/latest/zabbix_maintenance_module.html#requirements-on-host-that-executes-module)

---

<div class="post-metadata">

**Author:** ![Andrew\_Morgan](https://avatars.discourse-cdn.com/v4/letter/a/50afbb/32.png) [@Andrew\_Morgan](https://forum.ansible.com/u/Andrew_Morgan)\
**Post date:** [January 25, 2018, 8:10pm UTC](https://forum.ansible.com/t/ansible-zabbix-module-issues/26552/5 "2018-01-25T20:10:41Z")

</div>

lol wow thanks, hmm, missed that.

---

<div class="post-metadata">

**Author:** ![Andrew\_Morgan2](https://avatars.discourse-cdn.com/v4/letter/a/6bbea6/32.png) [@Andrew\_Morgan2](https://forum.ansible.com/u/Andrew_Morgan2)\
**Post date:** [January 26, 2018, 5:36am UTC](https://forum.ansible.com/t/ansible-zabbix-module-issues/26552/6 "2018-01-26T05:36:38Z")

</div>

Thank you helping, but I am still getting the same error:

`  
ansible-playbook playbook.yaml

PLAY [zabbix] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

TASK [Gathering Facts] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
ok: [zabbix\_server]

TASK [Install requirement] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
ok: [zabbix\_server]

TASK [This is installation] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
fatal: [zabbix\_server]: FAILED! =\> {“changed”: false, “msg”: “Missing required zabbix-api module (check docs or install with: pip install zabbix-api)”}  
to retry, use: --limit @/ansible/playbook.retry

PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
zabbix\_server : ok=2 changed=0 unreachable=0 failed=1  
`

on the zabbix server:

`root@zabbix ~]# python --version Python 2.7 [root@zabbix ~]# pip install zabbix-api Requirement already satisfied: zabbix-api in /usr/local/lib/python2.7/site-packages [root@zabbix ~]#`

---

<div class="post-metadata">

**Author:** ![Andrew\_Morgan2](https://avatars.discourse-cdn.com/v4/letter/a/6bbea6/32.png) [@Andrew\_Morgan2](https://forum.ansible.com/u/Andrew_Morgan2)\
**Post date:** [January 26, 2018, 5:39am UTC](https://forum.ansible.com/t/ansible-zabbix-module-issues/26552/7 "2018-01-26T05:39:55Z")

</div>

`  
The full traceback is:  
File “/tmp/ansible\_XXjWDO/ansible\_module\_zabbix\_maintenance.py”, line 164, in   
from zabbix\_api import ZabbixAPI

fatal: [zabbix\_server]: FAILED! =\> {  
“changed”: false,  
“invocation”: {  
“module\_args”: {  
“collect\_data”: true,  
“desc”: “Setting up maintenance window for builds”,  
“host\_groups”: [  
“Discovered host”,  
“Linux servers”  
],  
“host\_names”: null,  
“http\_login\_password”: null,  
“http\_login\_user”: null,  
“login\_password”: “VALUE\_SPECIFIED\_IN\_NO\_LOG\_PARAMETER”,  
“login\_user”: “Admin”,  
“minutes”: 90,  
“name”: “Zabbix123”,  
“server\_url”: “http:/l.net”,  
“state”: “present”,  
“timeout”: 10  
}  
},  
“msg”: “Missing required zabbix-api module (check docs or install with: pip install zabbix-api)”

`

---

<div class="post-metadata">

**Author:** ![Andrew\_Morgan](https://avatars.discourse-cdn.com/v4/letter/a/50afbb/32.png) [@Andrew\_Morgan](https://forum.ansible.com/u/Andrew_Morgan)\
**Post date:** [January 26, 2018, 8:28pm UTC](https://forum.ansible.com/t/ansible-zabbix-module-issues/26552/8 "2018-01-26T20:28:56Z")

</div>

any response please?

---

<div class="post-metadata">

**Author:** ![Malcolm\_Hussain-Gamb](https://avatars.discourse-cdn.com/v4/letter/m/90db22/32.png) [@Malcolm\_Hussain-Gamb](https://forum.ansible.com/u/Malcolm_Hussain-Gamb)\
**Post date:** [January 27, 2018, 7:31pm UTC](https://forum.ansible.com/t/ansible-zabbix-module-issues/26552/9 "2018-01-27T19:31:33Z")

</div>

The only thing I can think is on the  
Zabbix server the version of python sensible is using isn't 2.7 but some other one? Is there another python installed on the zabbix server??

That's a wild guess btw

---

<div class="post-metadata">

**Author:** ![Andrew\_Morgan](https://avatars.discourse-cdn.com/v4/letter/a/50afbb/32.png) [@Andrew\_Morgan](https://forum.ansible.com/u/Andrew_Morgan)\
**Post date:** [January 28, 2018, 12:34am UTC](https://forum.ansible.com/t/ansible-zabbix-module-issues/26552/10 "2018-01-28T00:34:41Z")

</div>

Thank you for your response…  
Yes, from what I can see there are multiple versions,

`  
whereis python

python: /usr/bin/python2.6 /usr/bin/python /usr/bin/python2.6-config /usr/lib/python2.6 /usr/lib64/python2.6 /usr/local/bin/python /usr/local/bin/python2.7-config /usr/local/bin/python2.7 /usr/local/lib/python2.7 /usr/include/python2.6 /usr/share/man/man1/python.1.gz

[root@zabbix ~]# which python  
/usr/local/bin/python

[root@zabbix ~]# /usr/local/bin/python --version  
Python 2.7

]# python  
python python2.6 python2.7 python-config  
python2 python2.6-config python2.7-config

`

---

<div class="post-metadata">

**Author:** ![Andrew\_Morgan2](https://avatars.discourse-cdn.com/v4/letter/a/6bbea6/32.png) [@Andrew\_Morgan2](https://forum.ansible.com/u/Andrew_Morgan2)\
**Post date:** [January 28, 2018, 9:12pm UTC](https://forum.ansible.com/t/ansible-zabbix-module-issues/26552/11 "2018-01-28T21:12:25Z")

</div>

I can also see something is happening on the zabbix server when the playbook runs

`

zabbix ansible-pip: Invoked with virtualenv=None virtualenv\_site\_packages=False virtualenv\_command=virtualenv chdir=None requirements=None name=[‘zabbix-api’] virtualenv\_python=None editable=False umask=None executable=None use\_mirrors=True extra\_args=None state=present version=None  
Jan 28 15:52:32 zabbix ansible-zabbix\_maintenance: Invoked with http\_login\_password=NOT\_LOGGING\_PARAMETER name=Zabbix123 server\_url=[http://zabbix.socialpatrol.net](http://zabbix.socialpatrol.net) login\_user=Admin http\_login\_user=None timeout=10 host\_names=None state=present host\_groups=[‘Discovered host’, ‘Linux servers’] login\_password=NOT\_LOGGING\_PARAMETER collect\_data=True minutes=90 desc=Setting up maintenance window for builds

`  
But nothing really happens

---

<div class="post-metadata">

**Author:** ![Andrew\_Morgan](https://avatars.discourse-cdn.com/v4/letter/a/50afbb/32.png) [@Andrew\_Morgan](https://forum.ansible.com/u/Andrew_Morgan)\
**Post date:** [January 30, 2018, 6:46am UTC](https://forum.ansible.com/t/ansible-zabbix-module-issues/26552/12 "2018-01-30T06:46:33Z")

</div>

any help??

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [January 30, 2018, 7:21am UTC](https://forum.ansible.com/t/ansible-zabbix-module-issues/26552/13 "2018-01-30T07:21:08Z")

</div>

Ansible is hard coded to /usr/bin/python i guess you /usr/bin/python is pointing to Python 2.6 but you have installed the module in the Python 2.7.

You need to clean up you environment so that match.

---

<div class="post-metadata">

**Author:** ![Andrew\_Morgan2](https://avatars.discourse-cdn.com/v4/letter/a/6bbea6/32.png) [@Andrew\_Morgan2](https://forum.ansible.com/u/Andrew_Morgan2)\
**Post date:** [January 31, 2018, 5:07am UTC](https://forum.ansible.com/t/ansible-zabbix-module-issues/26552/14 "2018-01-31T05:07:32Z")

</div>

thank you for “Ansible is hard coded to /usr/bin/python”…resolved

---

<div class="post-metadata">

**Author:** ![Linards\_Liepins](https://avatars.discourse-cdn.com/v4/letter/l/9f8e36/32.png) [@Linards\_Liepins](https://forum.ansible.com/u/Linards_Liepins)\
**Post date:** [April 4, 2018, 3:31pm UTC](https://forum.ansible.com/t/ansible-zabbix-module-issues/26552/15 "2018-04-04T15:31:18Z")

</div>

Hi, I am experiencing identical issue.

How did you changed this hardcoded path from python 2.6 (usr/bin/python) to python 2.7 (usr/bin/python)? What files you changed? How you changed them? To what values you changed the configuration?

trešdiena, 2018. gada 31. janvāris 07:07:33 UTC+2, Andrew Morgan rakstīja:

---

<div class="post-metadata">

**Author:** ![Valeriy\_Pastushenko](https://avatars.discourse-cdn.com/v4/letter/v/45deac/32.png) [@Valeriy\_Pastushenko](https://forum.ansible.com/u/Valeriy_Pastushenko)\
**Post date:** [November 29, 2018, 5:55pm UTC](https://forum.ansible.com/t/ansible-zabbix-module-issues/26552/16 "2018-11-29T17:55:30Z")

</div>

Hello, can you please tell us how you resolve this issue?
