# 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 -%>
<% if node['nagios']['multi_os_monitoring'] == true -%>
	hostgroups <%= n.run_list.roles.to_a.join(",") %>,<%= n.chef_environment %>,<%= n.os %>
<% else -%>
	hostgroups <%= n.run_list.roles.to_a.join(",") %>,<%= n.chef_environment %>
<% end -%>
<% elsif node['nagios']['multi_os_monitoring'] == true -%>
	hostgroups <%= n.run_list.roles.to_a.join(",") %>,<%= n.os %>
<% 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 -%>
<% if node['nagios']['multi_os_monitoring'] == true -%>
  hostgroups <%= n.run_list.roles.to_a.join(",") %>,<%= n.chef_environment %>,<%= n.os %>
<% else -%>
  hostgroups <%= n.run_list.roles.to_a.join(",") %>,<%= n.chef_environment %>
<% end -%>
<% elsif node['nagios']['multi_os_monitoring'] == true -%>
  hostgroups <%= n.run_list.roles.to_a.join(",") %>,<%= n.os %>
<% else -%>
  hostgroups <%= n.run_list.roles.to_a.join(",") %>
<% end -%>
}
<% end -%>

<% end -%>

Format change to fix writing out the erb
Format change to fix writing out the erb


Former-commit-id: 7597cdfcb8fb270d559f8dea55f79baa40d35661 [formerly 9ed5520ef4bf675e1ff446c0e778eca8666d647d] [formerly 4af6b34f1350d2ee62c6eae5a7f77a4eff4fbeed [formerly cc9dbf3c3aa75dbabb9589219d5fa45102f2b1a0]]
Former-commit-id: 142b5e18f4e7c3d5a8065f474ab1343bab24c815 [formerly fc1a9fa43aa2bd9f1a353726eb001134806eb9e3]
Former-commit-id: 08745c803503b7368c288c9b1c101884d4d16371