# When you use puppet, how do you separate the provisioning and maintenance code?

So say you're using puppet. Initially you might use the puppet server to set it up with a puppet agent to setup your server (you might, then again you might use images, but I'm using puppet).

Let's say that the initial provisioning goes well and then you decide you need to add some more settings to your server; but you don't want to re-provision it completely; wipe out the database on the system and start from scratch; instead you'd rather add the settings, perhaps remove some old ones, and then restart your daemon (which to be fair, may already be done by puppet)

Do you:

a. Comment out the initial provisioning code before running puppet apply?
b. Set a variable that can used by the code to prevent it from being re-provisioned?

How is this situation properly handled? Because handling it wrong seems likely to lead to disaster (recovery).

edit retag close merge delete

Environments. You use environments. However, I never really faced such situation, because I try to stick to Puppet paradigm of defining a state as best as I can. So my machines are usually finished after one or two Puppet-runs (and possibly a reboot).

( 2017-07-18 09:46:18 -0600 )edit

Sort by » oldest newest most voted

Puppet is about describing the desired state - so in our case, we had puppet modules for how the agent install should look, and how the puppet server configuration should be done, etc... We would 'puppet apply' the collection of modules to a node to bootstrap it, and then from then on it uses the same desired state to manage it.

One key thing to remember is that puppet only does what you tell it, and you need to make your changes cognizant of the existing set of state of your infrastructure... There are some changes that will work from 'base image' but will fail based on current configuration..

Some of the changes you mention (around databases, etc..) are things that require complex, ordered sets of instructions, typically across multiple machines. Base Opensource puppet is not as good with that, but Puppet Enterprise has the Application Orchestration ( https://puppet.com/product/capabiliti... https://docs.puppet.com/pe/latest/apporchestrationoverview.html ), I do know that the creator of mcollective is working on a set of plugins to bring 'playbook' like functionality to mcollective, and ease the setup burdeon over at http://choria.io/

more