Project

General

Profile

Bug #263

Updated by Daniel Curtis over 10 years ago

h2. Prepare the new Puppet Master server 

 I decided to separate the administrative server to a virtual node. To do this I created a new LXC node and installed @puppetmaster@ and @puppetmaster-passenger@: 
 <pre> 
 apt-get install puppetmaster puppetmaster-passenger 
 </pre> 

 h2. Migrate the old server data 

 I then used rsync to synchronize the configuration files and cache from the old server to the new server: 
 <pre> 
 rsync -avh -e ssh root@puppetmaster.orig.net:/etc/puppet /etc/ 
 rsync -avh -e ssh root@puppetmaster.new.net:/var/lib/puppet /var/lib/ 
 </pre> 
 This includes CA and SSL certificates, and configuration reports. This should allow a transparent migration to the new puppet master server by preserving the contents of the old puppet master server. 

 Dump the puppet SQL database: 
 <pre> 
 mysqldump -u root -p puppet > /path/to/backup/puppet.sql 
 </pre> 

 Then restor it into the new server: 
 <pre> 
 mysql -u root -p 

 CREATE DATABASE puppet; 
 GRANT ALL PRIVILEGES TO 'puppetuser'@'localhost' IDENTIFIED BY 'SuperSecretPassword'; 
 FLUSH PRIVILEGES; 
 EXIT 

 mysql -u root -p puppet < /path/to/restore/puppet 
 </pre> 

 h2. Set the puppet clients to use the new puppet master  

 master. This is as simple as changing the @puppet.conf@ on the clients and pointing them to the new server: 
 <pre> 
 #server=old.puppet.server.com 
 server=new.puppet.server.com 
 </pre> 

 h2. Troubleshooting 

 I got a few errors after setting the clients to the new puppet master server. 
 * After testing the puppet connection on the clients, the first error I recieved: 
 > err: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not autoload active_record: uninitialized constant ActiveRecord 
 and 
 > err: Could not retrieve catalog from remote server: Error 400 on SERVER: cannot load such file -- mysql 

 To solve this I had to install a few ruby gems: 
 <pre> 
 gem install metaclass mocha passenger railties rspec rspec-core rspec-expectations rspec-mocks ruby-mysql sprockets sprockets-rails stomp systemu test-unit thor tilt will_paginate actionmailer activerecord mysql daemon_controller ftools hiera hiera-puppet hike hoe httpclient 
 </pre> 

 * I started getting another error on the puppet clients after install the gems: 
 > err: Could not retrieve catalog from remote server: Error 400 on SERVER: Puppet::Parser::Compiler failed with error ArgumentError: wrong number of arguments (1 for 0) on node client1.puppet.server.com 

 This one took me a little while to solve, apparrently the problem was that @ruby1.9@ had been installed when I had installed the @vim-nox@ package. This caused the Apache Passenger module to compile Puppet Master under ruby1.9, a bug exists in puppet 2.7.6 that causes an error exactly the same as the one above. I removed @ruby1.9@ and @vim-nox@, and found that to solve the problem after restarting @apache2@: 
 <pre> 
 apt-get remove --purge ruby1.9 
 apt-get autoremove 
 apt-get clean 
 service apache2 restart 
 </pre> 

 h2. Resources 

 * http://projects.puppetlabs.com/issues/10963 
 * http://devblog.songkick.com/2013/04/02/migrating-to-a-new-puppet-certification-authority/

Back