# Adding Icinga Monitored Hosts via Ansible - Issues

**URL:** <https://forum.ansible.com/t/adding-icinga-monitored-hosts-via-ansible-issues/25841>\
**Category:** Ansible Project\
**Tags:** windows, awx\
**Created:** [October 27, 2017, 12:30pm UTC](https://forum.ansible.com/t/adding-icinga-monitored-hosts-via-ansible-issues/25841 "2017-10-27T12:30:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stuart\_Evans](https://avatars.discourse-cdn.com/v4/letter/s/dc4da7/32.png) [@Stuart\_Evans](https://forum.ansible.com/u/Stuart_Evans)\
**Post date:** [October 27, 2017, 12:30pm UTC](https://forum.ansible.com/t/adding-icinga-monitored-hosts-via-ansible-issues/25841/1 "2017-10-27T12:30:06Z")

</div>

Hi All,

I’m looking for some help with the Add Hosts roles in this repository [https://github.com/Icinga/icinga2-ansible](https://github.com/Icinga/icinga2-ansible) , whenever i try to add hosts to be monitored by Icinga I always get the below failure;

`  
{  
“msg”: “The task includes an option with an undefined variable. The error was: ‘dict object’ has no attribute ‘ansible\_fqdn’\n\nThe error appears to have been in ‘/var/lib/awx/projects/\_6\_\_icinga\_monitoring/icinga2-ansible-add-hosts/tasks/icinga2\_add\_hosts.yml’: line 2, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n—\n- name: Copy Host Definitions\n ^ here\n\nexception type: \<class ‘ansible.errors.AnsibleUndefinedVariable’\>\nexception: ‘dict object’ has no attribute ‘ansible\_fqdn’”,  
“failed”: true  
}

`

For information, this is my setup;

`  
Ansible AWX

ansible 2.4.1.0  
config file = /etc/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.7/site-packages/ansible  
executable location = /usr/bin/ansible  
python version = 2.7.5 (default, Aug 4 2017, 00:39:18) [GCC 4.8.5 20150623 (Red Hat 4.8.5-16)]

`

I have 1 inventory defined with 2 groups, monitoring\_servers and webservers - the monitoring server is the Centos Icinga Box and the webservers are Windows Servers. When running the playbook i always come across the undefined variable for the Icinga Box (in group monitoring\_servers), cant seem to get away from it and cant see whats going wrong? My playbook is as follows.

Any help would be appreciated…

Thanks!

`

---

<div class="post-metadata">

**Author:** ![Stuart\_Evans](https://avatars.discourse-cdn.com/v4/letter/s/dc4da7/32.png) [@Stuart\_Evans](https://forum.ansible.com/u/Stuart_Evans)\
**Post date:** [October 27, 2017, 1:02pm UTC](https://forum.ansible.com/t/adding-icinga-monitored-hosts-via-ansible-issues/25841/2 "2017-10-27T13:02:04Z")

</div>

Full playbook output;

`

SSH password:  
2  
Vault password:  
3  
4  
PLAY [Gather Windows System Info for Sytems to be Monitored] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*13:43:40  
5  
6  
TASK [Gathering Facts] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*13:43:40  
7  
ok: [web1]  
8  
ok: [web2]  
9  
ok: [web3]  
10  
ok: [web4]  
11  
ok: [web5]  
12  
ok: [web6]  
13  
ok: [web7]  
14  
ok: [web8]  
15  
16  
PLAY [Add Monitoring Config to Monitoring Hosts] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*13:43:49  
17  
18  
TASK [Gathering Facts] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*13:43:49  
19  
ok: [icinga]  
20  
21  
TASK [icinga2-ansible-add-hosts : include\_tasks] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*13:43:50  
22  
included: /var/lib/awx/projects/\_6\_\_icinga\_monitoring/icinga2-ansible-add-hosts/tasks/icinga2\_add\_hosts.yml for [GB1LICINV001.kbops.net](http://GB1LICINV001.kbops.net)  
23  
24  
TASK [icinga2-ansible-add-hosts : Copy Host Definitions] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*13:43:50  
25  
ok: [icinga] =\> (item=web1)  
26  
ok: [icinga] =\> (item=web2)  
27  
ok: [icinga] =\> (item=web3)  
28  
ok: [icinga] =\> (item=web4)  
29  
ok: [icinga] =\> (item=web5)  
30  
ok: [icinga] =\> (item=web6)  
31  
ok: [icinga] =\> (item=web7)  
32  
ok: [icinga] =\> (item=web8)  
33  
fatal: [icinga]: FAILED! =\> {“failed”: true, “msg”: “The task includes an option with an undefined variable. The error was: ‘dict object’ has no attribute ‘ansible\_fqdn’\n\nThe error appears to have been in ‘/var/lib/awx/projects/\_6\_\_icinga\_monitoring/icinga2-ansible-add-hosts/tasks/icinga2\_add\_hosts.yml’: line 2, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n—\n- name: Copy Host Definitions\n ^ here\n\nexception type: \<class ‘ansible.errors.AnsibleUndefinedVariable’\>\nexception: ‘dict object’ has no attribute ‘ansible\_fqdn’”}  
34  
35  
PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*13:43:55  
36  
icinga : ok=2 changed=0 unreachable=0 failed=1  
37  
web1 : ok=1 changed=0 unreachable=0 failed=0  
38  
web2 : ok=1 changed=0 unreachable=0 failed=0  
39  
web3 : ok=1 changed=0 unreachable=0 failed=0  
40  
web4 : ok=1 changed=0 unreachable=0 failed=0  
41  
web5 : ok=1 changed=0 unreachable=0 failed=0  
42  
web6 : ok=1 changed=0 unreachable=0 failed=0  
43  
web7 : ok=1 changed=0 unreachable=0 failed=0  
44  
web8 : ok=1 changed=0 unreachable=0 failed=0  
45  
^ TOP  
About AWX

`
