Puppet / Foreman Host name change what worked for me ;)

I needed to build a new Foreman / Puppet master as a prelude to upgrading
Foreman 1.2 to 1.4.

This was on a CentOS 6.4 VM so the first part was easy just take a clone
and give it a new hostname.

This may not be the best way of doing this: If you know of a better way
please let me know.

My steps - they may not work for you - so no guarantees so take backups.

First take a BACKUP. I was working on a clone so the old host was my backup.

Stop Puppet & Foreman.

service httpd stop

service foreman-proxy stop

Then edit the following files to change the hostname.

/etc/httpd/conf.d/puppet.conf

/etc/httpd/conf.d/foreman.conf

/etc/puppet/puppet.conf

/etc/puppet/node.rb

/usr/lib/ruby/site_ruby/1.8/puppet/reports/foreman.rb

/etc/foreman-proxy/settings/yml

You need a new set of certificates the way that works for me is:

rm -rf /var/li/puppet/ssl/

service puppetmaster start

That generates a new set of CA and Puppet certificates :slight_smile:

service puppetmaster stop

service httpd start

service foreman-proxy start

Login to Foreman and change the name of the SmartProxy and any [global]
parameters that have the hostname.

puppet agent --test

puppet agent --test

After any work on the server I like to force a puppet run and repeat it
until I get a puppet run without any actions.

On each of the Puppet clients that are moved to the new server:

edit /etc/puppet/puppet.conf # To change the server / puppetmaster name

rm -rf /var/li/puppet/ssl/

puppet agent --test

That works for me as my Puppet clients are run via a cronjob and I have
autosign enabled on the puppetmaster.

I hope that it helps if not I hope that it give you some pointers.

For the experts out there if you have a better way please let me know.

Regards, Mike.