Closed ahaerpfer closed 8 years ago
Actually, it's just the other way round and in Nagios IPs are not guaranteed to be unique but host names are! Trying to define two host objects with the same name results in a configuration error.
Having two hosts with the same IP address does not break Nagios. The by-name representation of the inventory works as expected in this case. However, in the by-IP representation omd_alias
and omd_name
of both objects end up as duplicates of the second host. In the static output we then have duplicate lines, in the JSON output there is only one hostvars
section for this IP.
--by-name
should be the default output format and --by-ip
a possible option.--by-ip
output format is selected.The warning for duplicate IPs will only be issued for --static
output. For the JSON output we try not to mess up things with additional (and potentially confusing) output … although ansible and ansible-playbook seem to completely discard output on stderr, anyway (i.e. it does not get printed to the TTY either).
Warp inventory data around and create output by host, e.g. (
--to-static
format):instead of the by-IP output
Open issues:
name
andalias
fields in Nagios!ansible_ssh_host
in favour of justansible_host
(see the related Ansible documentation). That's nice and cool, however, in Ansible versions prior to 2.0 the shorter variables are ignored without warning! Should we be able to produce old-style output, too?