hello,

I don't post here that often about Choria - a continuation of the MCollective 
project - but this time there is something of particular interest to Puppet 
users though I thought I'd drop a note.

You can now write Playbooks that integrate tools such as consul, etcd, 
terraform, Slack, graphite, PuppetDB PQL, MCollective and more all into one.  

You can use these to solve orchestration problems, you can make a collection of 
them and share them with your team or the community at large and more.

The official docs are here: https://choria.io/docs/playbooks/
I blogged about it here: 
https://www.devco.net/archives/2018/02/25/choria-playbooks-dsl.php

And below I'll put a sample for you to see

# Disables Puppet and Wait for all in-progress catalog compiles to end
plan acme::disable_puppet_and_wait (
  Enum[alpha, bravo] $cluster
) {
  choria::run_playbook(acme::slack_notify, message => "Disabling Puppet in 
cluster ${cluster}")
 
  $puppet_agents = choria::discover("mcollective",
    discovery_method => "choria",
    agents => ["puppet"],
    facts => ["cluster=${cluster}"],
    uses => { puppet => ">= 1.13.1" }
  )
 
  $ds = {
    "type" => "consul",
    "timeout" => 120,
    "ttl" => 60
  }
 
  choria::lock("locks/puppet.critical", $ds) || {
    choria::task(
      "action" => "puppet.disable",
      "nodes" => $puppet_agents,
      "fail_ok" => true,
      "silent" => true,
      "properties" => {"message" => "restarting puppet server"}
    )
 
    choria::task(
      "action"    => "puppet.status",
      "nodes"     => $puppet_agents,
      "assert"    => "idling=true",
      "tries"     => 10,
      "silent"    => true,
      "try_sleep" => 20,
    )
  }
 
  choria::run_playbook(acme::slack_notify,
    message => sprintf("Puppet disabled on %d nodes in cluster %s", 
$puppet_agents.count, $cluster)
  )
}

-- 
R.I.Pienaar / www.devco.net / @ripienaar

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/1519570681.3148398.1282669136.75F8CE85%40webmail.messagingengine.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to