CentOS8 host


yum install epel-release

yum install puppet


Then create the file puppet.conf in /etc/puppet/ or /etc/puppetlabs/puppet/ (the path depends on the version of puppet) with this content (replace 'cld-rbt-test-03' with your hostname):


# This file can be used to override the default puppet settings.
# See the following links for more details on what settings are available:
# - https://puppet.com/docs/puppet/latest/config_important_settings.html
# - https://puppet.com/docs/puppet/latest/config_about_settings.html
# - https://puppet.com/docs/puppet/latest/config_file_main.html
# - https://puppet.com/docs/puppet/latest/configuration.html
[agent]
server=cld-config.cloud.pd.infn.it
environment=production
ca_server=cld-config.cloud.pd.infn.it
certname=cld-rbt-test-03.cloud.pd.infn.it


Run puppet:


root@cld-rbt-test-03 ~]# puppet agent -t
Info: Creating a new RSA SSL key for cld-rbt-test-03.cloud.pd.infn.it
Info: csr_attributes file loading from /etc/puppetlabs/puppet/csr_attributes.yaml
Info: Creating a new SSL certificate request for cld-rbt-test-03.cloud.pd.infn.it
Info: Certificate Request fingerprint (SHA256): 16:A6:29:B2:E6:C0:B9:14:7E:62:74:E6:58:5C:0E:33:36:7E:7C:88:5E:32:EE:EB:70:DD:31:EE:DC:3A:1E:FD
Info: Certificate for cld-rbt-test-03.cloud.pd.infn.it has not been signed yet
Couldn't fetch certificate from CA server; you might still need to sign this agent's certificate (cld-rbt-test-03.cloud.pd.infn.it).
Exiting now because the waitforcert setting is set to 0.


In case of errors (because the host was already in puppet) see


[root@cld-config files]# puppetserver ca clean --certname cld-rb-test-03.cloud.pd.infn.it



See also Risolvere problema con i certificati (puppet agent -t)


On cld-config:


[

root@cld-config modules]# puppetserver ca sign --all
Successfully signed certificate request for cld-rbt-test-03.cloud.pd.infn.it
[root@cld-config modules]# 


Run again puppet on the host:


[root@cld-rbt-test-03 ~]# puppet agent -t
Info: csr_attributes file loading from /etc/puppetlabs/puppet/csr_attributes.yaml
Info: Creating a new SSL certificate request for cld-rbt-test-03.cloud.pd.infn.it
Info: Certificate Request fingerprint (SHA256): 16:A6:29:B2:E6:C0:B9:14:7E:62:74:E6:58:5C:0E:33:36:7E:7C:88:5E:32:EE:EB:70:DD:31:EE:DC:3A:1E:FD
Info: Downloaded certificate for cld-rbt-test-03.cloud.pd.infn.it from https://cld-foreman.cloud.pd.infn.it:8140/puppet-ca/v1
Warning: Unable to fetch my node definition, but the agent run will continue:
Warning: Error 500 on SERVER: Server Error: Failed to find cld-rbt-test-03.cloud.pd.infn.it via exec: Execution of '/etc/puppetlabs/puppet/node.rb cld-rbt-test-03.cloud.pd.infn.it' returned 1: 
Info: Retrieving pluginfacts
Info: Retrieving plugin
Notice: /File[/var/lib/puppet/lib/facter]/ensure: created
Notice: /File[/var/lib/puppet/lib/facter/concat_basedir.rb]/ensure: defined content as '{md5}e152593fafe27ef305fc473929c62ca6'
Notice: /File[/var/lib/puppet/lib/facter/facter_dot_d.rb]/ensure: defined content as '{md5}9f65108ecd7b8c5ce9c90ab4cd9d45be'
Notice: /File[/var/lib/puppet/lib/facter/get_ips.rb]/ensure: defined content a

....

...


The host should now appear on foreman.

Move it to the proper host group (e.g. hosts_all)


Enable and start puppet on the host:


[root@cld-rbt-test-03 ~]# systemctl start puppet
[root@cld-rbt-test-03 ~]# systemctl enable puppet
Created symlink /etc/systemd/system/multi-user.target.wants/puppet.service → /usr/lib/systemd/system/puppet.service.
[root@cld-rbt-test-03 ~]#