Add new facts to host properties table

Hello everyone,

I would like to add new facts to the table of properties you can find under: https://foreman..com/hosts/

I am referring to this table:
image

Is this possible?

I saw this plugin: GitHub - sfu-rcg/foreman_host_overview: Modifies the properties table for all hosts in the Foreman but it seems pretty outdated and I am wondering if there might be better ways of doing it.

Thanks a lot for your help,
Daniel.

Imho there’s no better way than through writing a plugin. However, we’re redesigning the host detail page. It would be awesome if you share what informatiom you’d like to see there and why. If they are generally useful, we can perhaps easilly add them to the current page too.

1 Like

Hi Marek,

thanks a lot for your answer.

At the moment we are (kinda) using Foreman as our Configuration management database.
In Foreman we store devices such us servers, desktops and laptops.

We have a custom fact “assignee” so we know whose user the device is assigned to.

We would like to see this custom fact in directly in the host properties page. I hope this makes sense :slight_smile:

Thanks a lot,
Daniel.

Gotcha, that totally makes sense. I assume assignees don’t have Foreman account, so you can’t use Host owner field for that. This feels as a generally useful thing to have - ability to select custom fact to be displayed on host detail page. cc @MariSvirik @amirfefer @tbrisker

If you don’t mind I’d like to ask for few more details about the use case. I wonder how you set the custom fact. Do you set that on every host manually? If so, why didn’t you use host parameters for this purpose and manage that centrally in Foreman? Can users of a given machine forge the assignee by changing the custom fact (given they have root access) and is that a concern in your environment? Do you use this custom fact somewhere else in the configuration management? Given the host comment attribute is also exposed in the ENC output, could you potentially use that? I assume we’ll be showing the host comment better in the new host detail page that we do today.

Thanks for all valuable information!

2 Likes

We have a in-house developed puppet module that is applied to every single host in the organization.
This module includes a custom fact that sets the value of the current assignee of the device.

Can users of a given machine forge the assignee by changing the custom fact (given they have root access) and is that a concern in your environment?

Well, technically yes, but I don’t think we care that much about it. Having the value in puppet/foreman is something that comes handy for us, so we can identify easily whose device is assigned to. It’s more an informative field than anything else.

Given the host comment attribute is also exposed in the ENC output, could you potentially use that?

I tried your suggestion and it worked! It’s a bit of a workaround but it does the trick, thanks!

image

1 Like

Cool, I’m glad it helped. I think a better fit would be using Parameters, you could define a Global parameter “Owner” with some defaul value, e.g. “Danielfr Test” and then override this per Host (or host group or OS or …). There are two benefits, the overriding and the ability to give a parameter custom name. The current host detail page unfortunatelly does not display the Parameters but the new one will.

2 Likes

Thanks again for your help Marek!