While experimenting with Foreman and Ansible… it just occurred to me that its Job output, is very similar to rundeck output.
It would be really nice to unify onto one system instead of running separate priviledged foreman and rundeck servers.
The main thing getting in the way that I can see, is rundeck jobs have a built in list of servers a job is expected to run on.
I figure as long as I can easily group hosts in various ways, then search on a criteria… hit “select all”… and then run a job… it would be fine.
But I was surprised to find my options are rather limited.
One way of doing this that I have found, is to fake it with puppet “config groups”.
Even though I am NOT USING puppet… I can create config groups without any classes in them.
I can then assign hosts to MULTIPLE config groups (that part is key. using hostgroups for this is too limiting, since a host can only be in one hostgroup)
I can then do a host search for “config_group = Webservers” for example, and then easily select all webservers to run a predefined job.
So I then have two related questions:
Is there a better way to do this?
I saw a warning that puppet is being abstracted out as a separate module in foreman 3.0
Please, please tell me there is going to be some kind of similar flexible host grouping capability, that wont require the puppet module, in foreman 3.0 ?
I think I have a better way. I hope to blog about it at some point, but using parameters can serve as a tagging mechanism. But you’re right, config groups were meant for this.
You can, but in upcoming version (2.6 / 3.0) this is being extracted to the puppet plugin and you’d have to install that plugin just to get config groups functionality. So I wouldn’t encourage it.
What I use in my Foreman is parameters. Define a global parameter under Configure -> Global Parameter, e.g. “host_category”. You can set a default value in there and then override it on various levels. In this case, it may make sense to override directly on a host level in host edit form. You can then search for hosts by a term like
params.host_category = devel.
The obvious limitation is, host can have a single value for a given parameter. However you can specify multiple values separated by e.g. comma and then search for the value using
~. The query like
params.host_category ~ devel translates into SQL with condition like LIKE ‘devel%’)`.
The parameter can even be defined as an array, values defined as
["a", "b", "c"], the searching done by
params.tags ~ "c" then creates the following
ILIKE '%%c%%'). Let us know if that is usable in your case.
If searching like this works fine, it’s then easy to create Host bookmarks (saved search terms) that you can easily use in job invocation form too.
Thank you for the suggestion.
I think we will go in a similar yet slightly different direction. We want flexible multivalue per host, but not arrays.
Something more along the lines of setting parameters like
web_host = true
tomcat_host = true
Then there is a nice clean autocomplete output for
(searchbox) params.(autocomplete list here)
For documentation completeness, I will observe that it is not required to set those values as a “global parameter” at all.
However, doing so, gives people a nice menu style checklist when creating a new host, and knowing what parameters it could be good to set for it.