Error while running foremain-installer

Problem: I had foreman 3.5 running as expected and performed upgrade to version 3.6.
Everything went well but at the very last step I see some errors. As a result, smart proxy that is running on the same system as foreman did not get updated

2023-11-07 11:06:43 [ERROR ] [configure] Host does not exist in Foreman at
2023-11-07 11:06:43 [ERROR ] [configure] /Stage[main]/Foreman::Register/Foreman_instance_host[]/ensure: change from 'absent' to 'present' failed: Host does not exist in Foreman at
2023-11-07 11:06:45 [ERROR ] [configure] Error making POST request to Foreman at URL Only one declaration of a proxy is allowed
2023-11-07 11:06:45 [ERROR ] [configure] /Stage[main]/Foreman_proxy::Register/Foreman_smartproxy[]/ensure: change from 'absent' to 'present' failed: Error making POST request to Foreman at URL Only one declaration of a proxy is allowed
2023-11-07 11:06:50 [NOTICE] [configure] System configuration has finished.

Smart proxy was configured successfuly during initial installation.
I tried to change the name of the foreman to FQDN, smae for proxy, made no difference in any combination of short name or FQDN.
Expected outcome:
Expected smart proxy to be upgraded to the same version 3.6
Foreman and Proxy versions:
Now Foreman is 3.6 but proxy is still 3.5
Foreman and Proxy plugin versions:

Distribution and version:
Runs on Rocky 8.8 fully updated
Other relevant data:
I have it-foreman listed in hosts in Foreman web interface.

Hi @lflaks

Was there any errors in the /var/log/foreman-proxy/proxy.log

You said you tried to change the name, was this done during the same installer run or a subsequent run?

Changing the name will require the certs to be regenerated as well.

I am back to original short names both for the system listed in Foreman and smart proxy. Ran foreman-installer again. Exactly the same error as in my original post. Nothing added /var/log/foreman-proxy/proxy.log. No errors there.
I did not change any names during the run. Made changes, started new installer run.
I see some strange entries in /var/log/foreman-installer/katello.log:

2023-11-07 14:07:49 [ERROR ] [configure] Host does not exist in Foreman at
2023-11-07 14:07:49 [ERROR ] [configure] /Stage[main]/Foreman::Register/Foreman_instance_host[]/ensure: change from 'absent' to 'present' failed: Host it-for

And then, some ~100 lines later another error:

2023-11-07 14:07:52 [ERROR ] [configure] Error making POST request to Foreman at URL Only one declaration of a proxy is allowed
2023-11-07 14:07:52 [ERROR ] [configure] /Stage[main]/Foreman_proxy::Register/Foreman_smartproxy[]/ensure: change from 'absent' to 'present' failed: Error making POS
T request to Foreman at URL Only one declaration of a proxy is allowed`

Everything else is marked as DEBUG.

Now that you are back to shortnames, if you are able to load up the UI or we can do it with hammer host list do you see this host does not exist in Foreman listed?

@ekohl do you have any pointers here as well?

The web interface is up. I can see host it-foreman listed but not
That is why I was try ing to play with short name - FQDN. All my nodes are listed as short names. I have no idea why foreman thinks of itself with the long name. That could be the root of my problem.
Hammer command shows it with global status Error though:

[root@it-foreman ~]# hammer host list | grep it-foreman
1  | it-foreman      | Rocky 8.8        | Rocky/Rocky8               | A.B.C.D  | 00:50:56:9b:8d:4b | Error

System is doing provisioning and ansible orchestration as expected, by the way.

Yes, by default the installer assumes you’re registering with the FQDN:

For the former we don’t have a parameter. We should but short term you can add the following to /etc/foreman-installer/custom-hiera.yaml:

foreman::register::foreman_host_name: '%{alias('foreman_proxy::registered_name')}'

That should set the value as an alias for whatever is passed to --foreman-proxy-registered-name, which is the parameter that fixes the latter. You should be able to use foreman-installer --foreman-proxy-registered-name it-foreman now.

Thank you for looking into this!
I added suggested line to /etc/foreman-installer/custom-hiera.yaml file.
Now any attempt to run foreman-installer generates an error:

2023-11-08 09:45:25 [ERROR ] [root] Error: Evaluation Error: Error while evaluating a Function Call, Lookup of key 'lookup_options' failed: Unable to parse (/etc/foreman-installer/custom-hiera.yaml): did not find expected key while parsing a block mapping at line 24 column 1 (line: 108, column: 41) on node

This is happening even if I run foreman-installer --help

I don’t recognize that error. Can you share the content of custom-hiera.yaml?

Sure. Here it is:

[root@it-foreman foreman-installer]# cat custom-hiera.yaml
# This YAML file lets you set your own custom configuration in Hiera for the
# installer puppet modules that might not be exposed to users directly through
# installer arguments.
# For example, to set 'TraceEnable Off' in Apache, a common requirement for
# security auditors, add this to this file:
#   apache::trace_enable: Off
# Consult the full module documentation on,
# or the actual puppet classes themselves, to discover options to configure.
# Do note, setting some values may have unintended consequences that affect the
# performance or functionality of the application. Consider the impact of your
# changes before applying them, and test them in a non-production environment
# first.
# Here are some examples of how you tune the PostgreSQL options if needed:
# postgresql::server::config_entries:
#   max_connections: 600
#   shared_buffers: 1024MB
foreman::register::foreman_host_name: '%{alias('foreman_proxy::registered_name')}'

I didn’t test it. It might be failing on the use of the same quotes for the inner and outer parts. How about

foreman::register::foreman_host_name: "%{alias('foreman_proxy::registered_name')}"

Yes, that was it! It works now.
foreman-installer works without errors.
Thank you very much for help.


Thanks for the help @ekohl marking this one as complete/solved.