Tuesday, March 08th, 2011 | Author:

eth0It has been quite calm for a couple of months here. I have switched job, it explains why I had less time to post some things.I now work at fotolia, and I switched from puppet to chef (no troll intended, I still think puppet is a great tool, please read this).

However, a tool I still have is the awesome mcollective. Unfortunately, the most used agents (package, service) relay on puppet providers to do their actions. Fortunately, open source is here, so I wrote a (basic) service agent that uses chef providers to start/stop or restart an agent. It still needs some polish for the status part (ho the ugly hardcoded path) but I was quite excited to share this. Freshly pushed on github !

Thanks to Jordan Sissel for minstrel, an awesome debug tool, the opscode team for the help on the provider and R.I. Pienaar for mcollective (and the support).

You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.

3 Responses

  1. I think you should be able to pass “supports :status => true” if you want to just have the provider be smart about restarting, rather than hard coding the status command.

    Nice work, Nico!

    Interestingly enough, this basic pattern works for every chef resource, not just services – you could probably bake a chef resource plugin that can handle any arbitrary resource.

    For extra points, you can also serialize the resource collection to disk – then you could easily build an mcollective agent that lets you send actions to exisiting resources (the agent would de-serialze the last full resource collection, find the resource specified, and call run_action :whatever on it.)

    Again, fun to see – let us know if we can help.

  2. 2

    I tried to pass the “supports” argument to the provider but failed, I’ll try to seek help the chef hacking IRC channel.

  3. 3

    I have tried you chef provider for services but getting error

    $mco rpc service stop service=sshd

    undefined method `reset_defaults_and_overrides’ for nil:NilClass