# Generated by Chef
# host definitions

define host {
  use server
  address <%= node['ipaddress'] %>
  host_name <%= node['hostname'] %>
  hostgroups <%= node['nagios']['server_role'] %>
}

<% @nodes.each do |n| -%>
<% unless n.name == node.name -%>
define host {
  use server
  address <%= n['ipaddress'] %>
  host_name <%= n['hostname'] %>
<% if n.run_list.roles.nil? || n.run_list.roles.length == 0 -%>
  hostgroups all
<% else -%>
  hostgroups <%= n.run_list.roles.to_a.join(",") %>
<% end -%>
}
<% end -%>

<% end -%>

# Generated by Chef
# host definitions

define host {
  use server
  address <%= node['ipaddress'] %>
  host_name <%= node['hostname'] %>
  hostgroups <%= node['nagios']['server_role'] %>
}

<% @nodes.each do |n| -%>
<% unless n.name == node.name -%>
define host {
  use server
  address <%= n['ipaddress'] %>
  host_name <%= n['hostname'] %>
<% if n.run_list.roles.nil? || n.run_list.roles.length == 0 -%>
  hostgroups all
<% elsif node['nagios']['multi_environment_monitoring'] == "true" -%>
  hostgroups <%= n.run_list.roles.to_a.join(",") %>,<%= n.chef_environment %>
<% else -%>
  hostgroups <%= n.run_list.roles.to_a.join(",") %>
<% end -%>
}
<% end -%>

<% end -%>

Add the nodes to the host groups for their chef environment
Add the nodes to the host groups for their chef environment


Former-commit-id: bf99773e90094b43b6b9dbd88136e31a5bb12724 [formerly cc5169fca1b082a2c9abeb85a65501bb7beddf3e] [formerly a9692976509dc15f0363fae115ba1073fb18c395 [formerly 23740035bc192675a46b38ab2de23aa575785b15]]
Former-commit-id: cedfc4d0aa96984bc9f7e4bda21655548ab015fc [formerly da995a897c35f40929201f68eb07e9b71d8a7c56]
Former-commit-id: 2ca533eb6a3e4d9c546fd7edb42e7216dcde78e7