/puppet-env-manager-agent

Choria/MCollective agent to update puppet environments on puppetservers

Primary LanguagePythonApache License 2.0Apache-2.0

puppet-env-manager-agent

A Choria/MCollective agent that invokes the puppet-env-manager library to update puppet environments on a puppetserver.

While the puppet-env-manager library is not currently open source, this agent is to demonstrate how a python mcollective agent can be implemented for real world tasks using py-mco-agent

Requirements

Installation

This project is packaged up as a puppet module and published to the forge as optiz0r-mcollective_agent_puppet_env. The easiest way to use it is to add this module to your Puppetfile:

mod "optiz0r-mcollective_agent_puppet_env"

And mcollective::plugin_classes list in hiera:

mcollective::plugin_classes:
  - mcollective_agent_puppet_env

Usage

choria req puppet_env update_all
Discovering nodes .... 1

1 / 1    0s [====================================================================] 100%

puppetserver.example.com

       Added: []
      Failed: []
     Removed: []
   Unchanged: ["development", "production"]
     Updated: []


---- request stats ----
               Nodes: 1 / 1
         Pass / Fail: 1 / 0
        No Responses: 0
Unexpected Responses: 0
          Start Time: 2019-09-18T22:25:57+0100
      Discovery Time: 2.000441088s
        Publish Time: 0s
          Agent Time: 3m8.087353344s
          Total Time: 3m10.087806976s

Or with JSON output for integration into other tools:

choria req puppet_env update_all -j
{
   "agent": "puppet_env",
   "action": "update_all",
   "replies": [
      {
         "sender": "puppetserver.example.com",
         "statuscode": 0,
         "statusmsg": "",
         "data": {
            "added": [],
            "failed": [],
            "removed": [],
            "unchanged": [
               "production",
               "development"
            ],
            "updated": []
         }
      }
   ],
   "request_stats": {
      "requestid": "d8ca514f6ed3498d9d553621f8407e37",
      "no_responses": [],
      "unexpected_responses": [],
      "discovered": 1,
      "failed": 0,
      "ok": 1,
      "responses": 1,
      "publish_time": 0,
      "request_time": 1.9469804,
      "discover_time": 2.0011542,
      "start_time_utc": 1569490017
   },
   "summaries": {}
}