# How do I move a node to a new environment?

I've created the folders under /etc/puppet/environments called "production" and "test", but when I remove nodes listed in the manifest under production and add them in the manifest under test, they can no longer find themselves on the puppetmaster. I'm new at this, I'm certain I've missed a step. If I re-add these agents to the producton manifest, they run fine. But I can't seem to get anything to recognize this new test environment. I have this line under [master] in puppet.conf : environmentpath = $confdir/environments Thanks in advance :) edit retag close merge delete ## 2 Answers Sort by » oldest newest most voted As far as I know, you can have the same nose listed in both environments on the same puppet master, all you have to do is update the agents configuration to use the environment you want. The reason your agent couldn't find the master was because it was still configured to ask for the production environment, and you removed it from its nose list. You can even demo the changes on a different environment with sudo puppet agent -t --environment test --noop To see what changes would have occurred. To make the change perminant, either update /etc/puppet/puppet.conf on your client/agent to point at the new environment, or use the appropriate puppet --configure argument. The main thing to understand is that you can have the same node listed in both environments, but only when the client makes its request does it tell the master which environment to use. This is useful if you have regular expression based node definitions. Hope that helps! If you have any more questions, feel free to ask! more Nevermind. Once I deactivated all my agents then readded them, it worked. I'm a total noob, so this may just seem like a dumb question to have asked. But, in case anyone else has this problem : I removed the certs from all my agents with this command : rm -rf /var/lib/puppet/ssl Then made sure my manifest in the new environment contained the nodes I wanted to be there. Then on the puppet master, I deactivated all the nodes which I wanted to move. I made a shell script that made it easy, but the commands were puppet cert clean$HOST puppet node clean $HOST puppet node deactivate$HOST

I'm not sure all of those were necessary.

Then, I tried readding my agents by issuing this command at all agents :

puppet agent --verbose --no-daemonize --onetime

Then, back on the puppet server (master), I signed all their certs with puppet cert sign $HOST If anybody would like the shell script, it's like this : HOSTLIST='hostname1 hostname2 etc' for HOST in${HOSTLIST[@]} do

puppet cert clean $HOST puppet node clean$HOST puppet node deactivate \$HOST

done

:)

more

Ive done silly things before... running puppet agent -t as my user instead of root, and then it not 'working' with the puppet deamon... due to the ssl key being in ~/.puppet/ instead of /var/lib/puppet

( 2016-05-26 20:54:25 -0600 )edit