Revision e478c9e7
Added by Glen Ogilvie over 10 years ago
config/settings.yml.example | ||
---|---|---|
# mcollective (uses mco puppet)
|
||
# puppetssh (run puppet over ssh)
|
||
# salt (uses salt puppet.run)
|
||
# customrun (calls a custom command with args)
|
||
:puppet_provider: puppetrun
|
||
|
||
# customrun command details
|
||
# Set :customrun_cmd to the full path of the script you want to run, instead of /bin/false
|
||
:customrun_cmd: /bin/false
|
||
# Set :customrun_args to any args you want to pass to your custom script. The hostname of the
|
||
# system to run against will be appended after the custom commands.
|
||
:customrun_args: -ay -f -s
|
||
|
||
:puppet_conf: /etc/puppet/puppet.conf
|
||
# whether to use sudo before the ssh command
|
||
:puppetssh_sudo: false
|
lib/proxy/puppet/customrun.rb | ||
---|---|---|
require 'proxy/puppet'
|
||
|
||
module Proxy::Puppet
|
||
class CustomRun < Runner
|
||
|
||
def run
|
||
cmd = SETTINGS.customrun_cmd
|
||
unless File.exists?( cmd )
|
||
logger.warn "#{cmd} not found."
|
||
return false
|
||
end
|
||
|
||
shell_command( [ escape_for_shell(cmd), SETTINGS.customrun_args, shell_escaped_nodes ] )
|
||
end
|
||
end
|
||
end
|
lib/puppet_api.rb | ||
---|---|---|
when "salt"
|
||
require 'proxy/puppet/salt'
|
||
@server = Proxy::Puppet::Salt.new(opts)
|
||
when "customrun"
|
||
require 'proxy/puppet/customrun'
|
||
@server = Proxy::Puppet::CustomRun.new(opts)
|
||
else
|
||
log_halt 400, "Unrecognized or missing puppet_provider: #{SETTINGS.puppet_provider || "MISSING"}"
|
||
end
|
Also available in: Unified diff
fixes #3936 added a method of running a custom tool, to trigger puppet.