Puppet run reverts hostgroup

Greetings everyone.

Something odd is happening here. Already looked for this, but didn’t find anything that could help me.

So I ask for your help.

Here is a short description:

  • I change a node’s hostgroup in Foreman’s interface;
  • Then I click on YAML button on host details and the change is ok at the file;
  • But when I run Puppet’s agent, the hostgroup parameter is set to it’s previous value.

So I ran watch 'less <puppetdir>/yaml/foreman/<node_fqdn>.yaml' on the PuppetServer and noticed that:

  • The value of hostgroup is still the old one;
  • When Puppet is compiling the catalog, it changes the hostgroup value to the correct one;
  • But when Puppet starts to apply the configuration, the hostgroup parameter in the yaml file is set back to the wrong value.

I have an external fact called foreman_hostgroup.txt that is placed at /etc/facter/facts.d.
This file is created by Puppet as below:

file { '/etc/facter/facts.d/foreman_hostgroup.txt':
   content => "foreman_hostgroup=${::hostgroup}"

But it seems to be doing the inverse, something like ‘$::hostgroup=$::foreman_hostgroup’.

Did anyone have the same problem and fixed it?

Actually, is this really a problem or the problem is between the chair and the keyboard?

Thanks for your time.


Puppet’s agent run is turning the hostgroup to previous value.

Expected outcome:

External fact foreman_hostgroup value updating as Foreman’s parameter hostgroup changes.

Foreman and Proxy versions:


Foreman and Proxy plugin versions:

Other relevant data:
[e.g. logs from Foreman and/or the Proxy, modified templates, commands issued, etc]
(for logs, surround with three back-ticks to get proper formatting, e.g.)


Have a look at a previous discussion.

Thanks, @ekohl.