0

We regularly rebooting R&D Linux and Windows servers for server patching and other additional maintenance. Lots of different services and development environments are hosted on the servers and need to be stop/start before and after rebooting the servers.

Puppet can be used to start the services, and ensure the services run in work time (as daemon). Could we use Puppet to stop the services before rebooting the server? I am thinking about write manifest for starting and stopping separately, disable starting manifest, and then apply the stopping manifest manually.

However, if the starting services manifest are not disabled and the resources that 'rebooting' depends on are trying to stop the services, while the daemon agents are ensuring to keep the services started. I am wondering what will happen then.

Any idea?

imapollo
  • 387
  • 1
  • 2
  • 16
  • Maybe I'm missing something, but couldn't you just use puppet to start the services up and ensure they keep running and write a normals init.d script (outside of puppet) which stops services when the server is booted? – kkeller Sep 09 '12 at 12:49
  • Two mean reasons for this: 1. Some rpc services may need to be shutdown depending on another remote server rather than the shutdown of local host. init.d script cannot handle these situations properly. 2. As IT is responsible for rebooting and patching, we want to make sure every services related to development are shutdown properly before hand over to IT. – imapollo Sep 09 '12 at 14:50

2 Answers2

0

Yes, you can.

Depending on your configuration:

  1. If puppet sends the reboot signal, you can execute a command before doing reboot via ssh this way:
ssh user@machine "command"

Where command could be:

service your_service stop
  1. If puppet does not know when the machines are going to reboot/shutdown, you can add a hook in order to execute a script (to stop services) when shutting down.
pbaris
  • 4,525
  • 5
  • 37
  • 61
arutaku
  • 5,937
  • 1
  • 24
  • 38
  • Thanks rmunoz. We would know when the machines are going to reboot, so we can use the first option. However, if the resources that 'rebooting' depends on are trying to stop the services, while the daemon agents are ensuring to keep the services started. I am wondering what will happen then. – imapollo Sep 09 '12 at 11:46
  • a bit late, how can we know when the machine is up & running? seems like we need to keep checking the status? – Bun Suwanparsert Apr 02 '19 at 11:10
0

My suggestion would be to introduce instrumentation (aside of configuration management). Have a look at MCollective[1] and Nanite[2]. Both allow you to write custom agents to execute custom actions. MCollective has the advantage of having tight integration with Puppet. You can use it to write custom agents as a apart of your deployment work-flow, that will stop services etc. Anyway, have a look at see if it would be of any use to you.

  1. http://puppetlabs.com/mcollective/introduction/
  2. https://github.com/ezmobius/nanite