Skip to content

Instantly share code, notes, and snippets.

@proffalken
Created May 27, 2011 20:33
Show Gist options
  • Save proffalken/996111 to your computer and use it in GitHub Desktop.
Save proffalken/996111 to your computer and use it in GitHub Desktop.
deploy.rb with MCollective and Puppet
set :stages, %w[staging production]
set :application, "Puppet Manifests"
set :repository, "git://localhost/puppet.git"
set :scm, :git
role :web, "puppetmaster" # set this to the fully qualified domain name of your puppetmaster
require 'capistrano/ext/multistage'
require 'mcollective'
#### MCOLLECTIVE STUFF ####
class MCProxy
include MCollective::RPC
def initialize(agent)
@agent = rpcclient(agent)
end
def runaction(action, args)
printrpc @agent.send(action, args)
end
end
namespace :puppet do
desc <<-DESC
Run Puppet to pull the latest versions
DESC
task :run do
puppet = MCProxy.new("puppetd")
puppet.runaction("runonce",:concurrency => '2')
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment