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

Patrick,

That's a really cool trick! Thanks for sharing. If you have any others, please share them also. This is a community forum, so it's great to see hints, tips, and experiences being shared.

Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.