Puppet Function: choria::task
- Defined in:
- lib/puppet/functions/choria/task.rb
- Function type:
- Ruby 4.x API
Overview
Execute Choria Playbook Tasks
Any task supported by Choria Playbooks is supported and can be used from within a plan, though there is probably not much sense in using the Bolt task type as you can just use ‘run_task` or `run_command` directly in the plan.
The options to Playbook tasks like ‘pre_book`, `on_success`, `on_fail` and `post_book` does not make sense within the Puppet Plan DSL.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/puppet/functions/choria/task.rb', line 37 Puppet::Functions.create_function(:"choria::task", Puppet::Functions::InternalFunction) do dispatch :run_task do scope_param param "String", :type param "Hash", :properties return_type "Choria::TaskResults" end dispatch :run_mcollective_task do scope_param param "Hash", :properties return_type "Choria::TaskResults" end def run_mcollective_task(scope, properties) run_task(scope, "mcollective", properties) end def run_task(scope, type, properties) require_relative "../../_load_choria" MCollective::Util::BoltSupport.init_choria.run_task(scope, type, properties) end end |