Sat 6.2 All hosts with my content view as a 'fact'

Latest response

Here is a trick you can use on a hostgroup to add a handy paramteter to your systems. I call mine content_view_hosts.

Hostgroup -> Parameters

<% begin -%><% if @host.content_view.system_names -%>[<% @host.content_view.system_names.sort.each do | hostname | -%>'<%= hostname %>',<% end -%>]<% end -%><% rescue => e -%>[]<% end -%>

This will set a fact on the host containing all the hosts that share your content view. It updates automatically when a new host checks in using your content view.

Example use case:
* All hosts using this content view should have port 12345 open to each other

Responses