Foreman proxy server installation issue

Problem:
There is an issue when running the foreman-installer command,
The command is generated from foreman server using foreman-proxy-certs-generate command.

  foreman-installer\
                    --scenario foreman-proxy-content\
                    --certs-tar-file                              "/root/smartproxy.example.com-certs.tar"\
                    --foreman-proxy-register-in-foreman           "true"\
                    --foreman-proxy-foreman-base-url              "https://satellite-server.example.com"\
                    --foreman-proxy-trusted-hosts                 "satellite-server.example.com"\
                    --foreman-proxy-trusted-hosts                 "smartproxy.example.com"\
                    --foreman-proxy-oauth-consumer-key            "eL3sMWeKsxiYaeSnH7zFZoEHBNVmg7Nk"\
                    --foreman-proxy-oauth-consumer-secret         "C9xtw4NQXmYGxNEL45AbJniKMqHwpzbv"

The below error is seen,

2023-04-04 03:42:42 [NOTICE] [root] Loading installer configuration. This will take some time.
2023-04-04 03:42:45 [NOTICE] [root] Running installer with log based terminal output at level NOTICE.
2023-04-04 03:42:45 [NOTICE] [root] Use -l to set the terminal output log level to ERROR, WARN, NOTICE, INFO, or DEBUG. See --full-help for definitions.
2023-04-04 03:44:45 [NOTICE] [configure] Starting system configuration.
2023-04-04 03:45:40 [NOTICE] [configure] 250 configuration steps out of 1104 steps complete.
2023-04-04 03:45:41 [ERROR ] [configure] Could not set 'present' on ensure: No such file or directory @ rb_sysopen - /root/ssl-build/proxy-satellite-server.example.com/proxy-satellite-server.e
xample.com-foreman-proxy-client.crt (file: /usr/share/foreman-installer/modules/certs/manifests/foreman_proxy.pp, line: 139)
2023-04-04 03:45:41 [ERROR ] [configure] Could not set 'present' on ensure: No such file or directory @ rb_sysopen - /root/ssl-build/proxy-satellite-server.example.com/proxy-satellite-server.e
xample.com-foreman-proxy-client.crt (file: /usr/share/foreman-installer/modules/certs/manifests/foreman_proxy.pp, line: 139)
2023-04-04 03:45:41 [ERROR ] [configure] Wrapped exception:
2023-04-04 03:45:41 [ERROR ] [configure] No such file or directory @ rb_sysopen - /root/ssl-build/proxy-satellite-server.example.com/proxy-satellite-server.example.com-foreman-proxy-client.crt
2023-04-04 03:45:41 [ERROR ] [configure] /Stage[main]/Certs::Foreman_proxy/Cert_key_bundle[/etc/pki/katello/private/proxy-satellite-server.example.com-foreman-proxy-client-bundle.pem]/ensure:
change from 'absent' to 'present' failed: Could not set 'present' on ensure: No such file or directory @ rb_sysopen - /root/ssl-build/proxy-satellite-server.example.com/proxy-satellite-server.
example.com-foreman-proxy-client.crt (file: /usr/share/foreman-installer/modules/certs/manifests/foreman_proxy.pp, line: 139)
2023-04-04 03:45:41 [ERROR ] [configure] Could not set 'present' on ensure: No such file or directory @ rb_sysopen - /root/ssl-build/proxy-satellite-server.example.com/proxy-satellite-server.e
xample.com-foreman-proxy.key (file: /usr/share/foreman-installer/modules/certs/manifests/keypair.pp, line: 18)
2023-04-04 03:45:41 [ERROR ] [configure] Could not set 'present' on ensure: No such file or directory @ rb_sysopen - /root/ssl-build/proxy-satellite-server.example.com/proxy-satellite-server.e
xample.com-foreman-proxy.key (file: /usr/share/foreman-installer/modules/certs/manifests/keypair.pp, line: 18)
2023-04-04 03:45:41 [ERROR ] [configure] Wrapped exception:
2023-04-04 03:45:41 [ERROR ] [configure] No such file or directory @ rb_sysopen - /root/ssl-build/proxy-satellite-server.example.com/proxy-satellite-server.example.com-foreman-proxy.key
2023-04-04 03:45:41 [ERROR ] [configure] /Stage[main]/Certs::Foreman_proxy/Certs::Keypair[proxy-satellite-server.example.com-foreman-proxy]/Private_key[/etc/foreman-proxy/ssl_key.pem]/ensure:
change from 'absent' to 'present' failed: Could not set 'present' on ensure: No such file or directory @ rb_sysopen - /root/ssl-build/proxy-satellite-server.example.com/proxy-satellite-server.
example.com-foreman-proxy.key (file: /usr/share/foreman-installer/modules/certs/manifests/keypair.pp, line: 18)
2023-04-04 03:45:41 [ERROR ] [configure] /Stage[main]/Certs::Foreman_proxy/Certs::Keypair[proxy-satellite-server.example.com-foreman-proxy]/File[/etc/foreman-proxy/ssl_cert.pem]: Could not eva
luate: Could not retrieve information from environment production source(s) file:///root/ssl-build/proxy-satellite-server.example.com/proxy-satellite-server.example.com-foreman-proxy.crt
2023-04-04 03:45:41 [ERROR ] [configure] Could not set 'present' on ensure: No such file or directory @ rb_sysopen - /root/ssl-build/proxy-satellite-server.example.com/proxy-satellite-server.e
xample.com-foreman-proxy-client.key (file: /usr/share/foreman-installer/modules/certs/manifests/keypair.pp, line: 18)
2023-04-04 03:45:41 [ERROR ] [configure] Could not set 'present' on ensure: No such file or directory @ rb_sysopen - /root/ssl-build/proxy-satellite-server.example.com/proxy-satellite-server.e
xample.com-foreman-proxy-client.key (file: /usr/share/foreman-installer/modules/certs/manifests/keypair.pp, line: 18)
2023-04-04 03:45:41 [ERROR ] [configure] Wrapped exception:
2023-04-04 03:45:41 [ERROR ] [configure] No such file or directory @ rb_sysopen - /root/ssl-build/proxy-satellite-server.example.com/proxy-satellite-server.example.com-foreman-proxy-client.key
2023-04-04 03:45:41 [ERROR ] [configure] /Stage[main]/Certs::Foreman_proxy/Certs::Keypair[proxy-satellite-server.example.com-foreman-proxy-client]/Private_key[/etc/foreman-proxy/foreman_ssl_ke
y.pem]/ensure: change from 'absent' to 'present' failed: Could not set 'present' on ensure: No such file or directory @ rb_sysopen - /root/ssl-build/proxy-satellite-server.example.com/proxy-sa
tellite-server.example.com-foreman-proxy-client.key (file: /usr/share/foreman-installer/modules/certs/manifests/keypair.pp, line: 18)
2023-04-04 03:45:41 [ERROR ] [configure] /Stage[main]/Certs::Foreman_proxy/Certs::Keypair[proxy-satellite-server.example.com-foreman-proxy-client]/File[/etc/foreman-proxy/foreman_ssl_cert.pem]
: Could not evaluate: Could not retrieve information from environment production source(s) file:///root/ssl-build/proxy-satellite-server.example.com/proxy-satellite-server.example.com-foreman-
proxy-client.crt
2023-04-04 03:45:41 [ERROR ] [configure] Could not set 'present' on ensure: No such file or directory @ rb_sysopen - /root/ssl-build/proxy-satellite-server.example.com/proxy-satellite-server.e
xample.com-apache.key (file: /usr/share/foreman-installer/modules/certs/manifests/keypair.pp, line: 18)
2023-04-04 03:45:41 [ERROR ] [configure] Could not set 'present' on ensure: No such file or directory @ rb_sysopen - /root/ssl-build/proxy-satellite-server.example.com/proxy-satellite-server.e
xample.com-apache.key (file: /usr/share/foreman-installer/modules/certs/manifests/keypair.pp, line: 18)
2023-04-04 03:45:41 [ERROR ] [configure] Wrapped exception:
2023-04-04 03:45:41 [ERROR ] [configure] No such file or directory @ rb_sysopen - /root/ssl-build/proxy-satellite-server.example.com/proxy-satellite-server.example.com-apache.key
2023-04-04 03:45:41 [ERROR ] [configure] /Stage[main]/Certs::Apache/Certs::Keypair[proxy-satellite-server.example.com-apache]/Private_key[/etc/pki/katello/private/katello-apache.key]/ensure: c
hange from 'absent' to 'present' failed: Could not set 'present' on ensure: No such file or directory @ rb_sysopen - /root/ssl-build/proxy-satellite-server.example.com/proxy-satellite-server.e
xample.com-apache.key (file: /usr/share/foreman-installer/modules/certs/manifests/keypair.pp, line: 18)
2023-04-04 03:45:41 [ERROR ] [configure] /Stage[main]/Certs::Apache/Certs::Keypair[proxy-satellite-server.example.com-apache]/File[/etc/pki/katello/certs/katello-apache.crt]: Could not evaluat
e: Could not retrieve information from environment production source(s) file:///root/ssl-build/proxy-satellite-server.example.com/proxy-satellite-server.example.com-apache.crt
2023-04-04 03:47:12 [NOTICE] [configure] 500 configuration steps out of 1109 steps complete.
2023-04-04 03:47:22 [NOTICE] [configure] 750 configuration steps out of 1112 steps complete.
2023-04-04 03:48:39 [NOTICE] [configure] 1000 configuration steps out of 1132 steps complete.
2023-04-04 03:48:54 [NOTICE] [configure] System configuration has finished.

  There were errors detected during install.
  Please address the errors and re-run the installer to ensure the system is properly configured.
  Failing to do so is likely to result in broken functionality.

  The full log is at /var/log/foreman-installer/foreman-proxy-content.log

Expected outcome:
Solve the issue when running the Foreman Installer command.
Foreman and Proxy versions:
Foreman 3.5 and Katello 4.7
Foreman and Proxy plugin versions:
Foreman 3.5 and Katello 4.7
Distribution and version:
Rocky Linux release 8.7 (Green Obsidian)

Did foreman-proxy-certs-generate run without errors? Check the content of the tar file. It looks like it’s empty or it’s missing those files.

From what you post, it seems your hostnames don’t match: the name in the command seems to be smartproxy.example.com but in the logs it seems it is proxy-satellite-server.example.com which is why it doesn’t find the content it is looking for…