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
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




On Friday, October 27, 2017 at 1:30:06 PM UTC+1, Stuart Evans wrote:
>
> Hi All,
>
> I'm looking for some help with the Add Hosts roles in this repository 
> 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!
>
> ---
>
>
> ##### Contact the monitored hosts to gather facts
>
>
> - name: Gather Windows System Info for Sytems to be Monitored
>   hosts: webservers
>   vars_files: 
>     - group_vars/windows.yml
>   gather_facts: true
>
>
> ##### Contact the monitoring servers to copy host definitions
>
>
> - name: Add Monitoring Config to Monitoring Hosts
>   hosts: monitoring_servers
>   vars: 
>     cpu_warning: 80
>     cpu_critical: 90
>     disk_warning: 80
>     disk_critical: 90
>   roles:
>    - role: icinga2-ansible-add-hosts
>      configuration_logic: "object"
>      icinga_host_attributes:
>        check_command: "ping4"
>        vars.sla: "24x7"
>      host_checks: |
>        object Service "cpu" {
>          host_name = "{{ hostvars[item]['ansible_fqdn'] }}"
>          check_command = "snmp-load"
>          vars.snmp_community = "snmp"
>          vars.snmp_warn = {{ cpu_warning }}
>          vars.snmp_crit = {{ cpu_critical }}
>        }
>        object Service "mem" {
>          host_name = "{{ hostvars[item]['ansible_fqdn'] }}"
>          check_command = "snmp-storage"
>          vars.snmp_community = "snmp"
>          vars.snmp_storage_name = "Mem"
>          vars.snmp_warn = {{ disk_warning }}
>          vars.snmp_crit = {{ disk_critical }}
>        }
>        object Service "disk-c" {
>          host_name = "{{ hostvars[item]['ansible_fqdn'] }}"
>          check_command = "snmp-storage"
>          vars.snmp_community = "snmp"
>          vars.snmp_storage_name = "C"
>          vars.snmp_warn = {{ disk_warning }}
>          vars.snmp_crit = {{ disk_critical }}
>        }
>          object Service "disk-d" {
>          host_name = "{{ hostvars[item]['ansible_fqdn'] }}"
>          check_command = "snmp-storage"
>          vars.snmp_community = "snmp"
>          vars.snmp_storage_name = "D"
>          vars.snmp_warn = {{ disk_warning }}
>          vars.snmp_crit = {{ disk_critical }}
>        }
>          object Service "disk-e" {
>          host_name = "{{ hostvars[item]['ansible_fqdn'] }}"
>          check_command = "snmp-storage"
>          vars.snmp_community = "snmp"
>          vars.snmp_storage_name = "E"
>          vars.snmp_warn = {{ disk_warning }}
>          vars.snmp_crit = {{ disk_critical }}
>        }
>      tags: add-hosts
> ...
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/716267a7-d46a-47fc-a45a-e78b1bbc738e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to