Follow these steps to change the hostname of your Puppet Enterprise primary server. These steps are not tested for installations that have a separate PE-PostgreSQL node.
If you want to change the DNS alt name of your primary server instead (a shorter, simpler process), follow the steps in our documentation to regenerate your primary server certificate.
Version and installation information
PE version: 2019.8 and later
Installation type: Supported architectures with or without disaster recovery. Not tested for installations that have a separate PE-PostgreSQL node.
Solution
Complete all of these steps on the primary server unless otherwise noted.
-
If you have a replica, use these steps to forget the replica. You will reprovision your replica on the same node in a later step.
-
On the replica, stop all PE services.
puppet resource service puppet ensure=stopped; puppet resource service pxp-agent ensure=stopped; puppet resource service pe-postgresql ensure=stopped; puppet resource service pe-puppetdb ensure=stopped; puppet resource service pe-puppetserver ensure=stopped; puppet resource service pe-console-services ensure=stopped; puppet resource service puppet ensure=stopped;
-
On the primary server, run
puppet infrastructure forget <REPLICA CERTNAME>
-
Clean up
pglogical
artifacts. On the primary server, runpuppet apply -e 'class {"puppet_enterprise":};["pe-classifier","pe-inventory","pe-activity","pe-rbac","pe-orchestrator"].each |$db| { puppet_enterprise::psql{ "Drop pglogical on ${db}": db => $db, command => "DROP EXTENSION pglogical CASCADE"}}'
-
-
On the primary server, to ensure that
/etc/puppetlabs/enterprise/conf.d/user_data.conf
is up to date, runpuppet infrastructure recover_configuration
-
Disable Puppet runs by running
puppet agent --disable
-
In the console, make the following changes.
-
In the PE Agent, PE Infrastructure Agent, and PE Master node groups, in all class parameters, change each instance of the old certname to the new hostname.
-
Unpin the old certname from the following node groups
- PE Certificate Authority
- PE Console
- PE Database
- PE Master
- PE Orchestrator
- PE PuppetDB
-
Commit the changes.
Note Do not apply them with a
puppet run
.
-
-
Run
puppet node purge <OLD CERTNAME>
-
Stop all PE services. On the primary server, run
puppet resource service puppet ensure=stopped; puppet resource service pxp-agent ensure=stopped; puppet resource service pe-postgresql ensure=stopped; puppet resource service pe-puppetdb ensure=stopped; puppet resource service pe-puppetserver ensure=stopped; puppet resource service pe-orchestration-services ensure=stopped; puppet resource service pe-console-services ensure=stopped; puppet resource service pe-nginx ensure=stopped; puppet resource service pe-bolt-server ensure=stopped; puppet resource service pe-ace-server ensure=stopped;
-
Change your primary server hostname. This varies by OS. For example, run
hostnamectl set-hostname <NEW HOSTNAME>; systemctl restart network
-
On the primary server and replica (if you have one), replace all instances of the old certname with the new hostname in the following files:
/etc/puppetlabs/puppet/puppet.conf
/etc/puppetlabs/puppet/puppetdb.conf
/etc/puppetlabs/enterprise/conf.d/pe.conf
/etc/puppetlabs/enterprise/conf.d/user_data.conf
-
In
/etc/puppetlabs/enterprise/conf.d/pe.conf
, if you are using the default value forpuppet_enterprise::puppet_master_host
(which is%{::trusted.certname}
), replace it with the new hostname. -
Remove the following files. They will be regenerated in a later step with correct values for the new hostname.
/etc/puppetlabs/nginx/conf.d/proxy.conf
/etc/puppetlabs/nginx/conf.d/http_redirect.conf
/etc/puppetlabs/puppetdb/certificate-whitelist
/etc/puppetlabs/puppetdb/certificate-allowlist
/etc/puppetlabs/console-services/rbac-certificate-whitelist
/etc/puppetlabs/console-services/rbac-certificate-allowlist
/opt/puppetlabs/puppet/cache/client_data/catalog/<CERTNAME>.json
-
Make a backup of the existing cert and keys located at
/etc/puppetlabs/puppet/ssl
. Runmv /etc/puppetlabs/puppet/ssl/ <SOME OTHER DIRECTORY>/backup
Note: Cert information is removed from
/etc/puppetlabs/
in the next step, so back up the cert and keys to another directory. -
Delete unneeded artifacts and configuration for the old certname. Run:
-
find /etc/puppetlabs/ -name <OLD CERTNAME>.* -delete
-
find /opt/puppetlabs/ -name <OLD CERTNAME>.* -delete
-
-
To generate a new certificate, run
/opt/puppetlabs/bin/puppetserver ca generate --certname <NEW HOSTNAME> --ca-client --force
You can safely ignore the warning about Puppet Server being offline.
-
Run
puppet infrastructure configure --no-recover
You can safely ignore errors generated by this command.
-
To enable the agent, run
puppet agent --enable
-
Run
puppet agent -t
twice. -
On all compilers
-
Stop the pe-puppetserver and pe-puppetdb services. Run
puppet resource service pe-puppetdb ensure=stopped; puppet resource service pe-puppetserver ensure=stopped;
-
Delete the allowlist files
etc/puppetlabs/puppetdb/certificate-whitelist
and/etc/puppetlabs/puppetdb/certificate-allowlist
, if they exist. -
Run
puppet agent -t --server_list <NEW HOSTNAME>
-
-
Run
puppet infrastructure status
and check the output to ensure that all services are running normally on the primary server and any compilers. -
If you have a replica, complete the following steps.
-
On the replica, replace all instances of the old certname with the new hostname in
/etc/puppetlabs/pxp-agent/pxp-agent.conf
and/etc/puppetlabs/puppet/puppet.conf
-
On the replica, delete the following allowlist files, if they exist:
/etc/puppetlabs/puppetdb/certificate-whitelist
/etc/puppetlabs/puppetdb/certificate-allowlist
/etc/puppetlabs/console-services/rbac-certificate-whitelist
/etc/puppetlabs/console-services/rbac-certificate-allowlist
-
On the replica, generate a new certificate signing request (CSR) by running:
-
puppet ssl clean
-
puppet agent -t
-
-
On the primary server, sign the CSR for the replica by running
puppetserver ca sign --certname <REPLICA CERTNAME>
-
On the replica, run
puppet agent -t
The Puppet run should restart pxp-agent service. Ensure that it is running with
puppet resource service pxp-agent
-
To start the puppet service, run
puppet resource service puppet ensure=running
-
On the primary server, to reprovision the replica, run
puppet infrastructure provision replica --enable <REPLICA CERTNAME>
-
How can we improve this article?
0 comments
Please sign in to leave a comment.
Related articles