Browse Source

Adding support for remote plugin deployment

cmacrae 9 years ago
parent
commit
9385966731
6 changed files with 29 additions and 1 deletions
  1. 1 0
      README.md
  2. 1 0
      defaults/main.yml
  3. 18 0
      docs/remote_plugins.md
  4. 1 0
      docs/role_variables.md
  5. 1 0
      mkdocs.yml
  6. 7 1
      tasks/plugins.yml

+ 1 - 0
README.md

@@ -85,6 +85,7 @@ _Note: The above options are intended to provide users with flexibility. This al
 | `sensu_include_dashboard` | `false` | Determines whether to deploy the Uchiwa dashboard |
 | `sensu_master` | `false` | Determines if a node is to act as the Sensu "master" node |
 | `sensu_user_name`| sensu | The name of the Sensu service user |
+| `sensu_remote_plugins` | _undefined_ | Sensu plugins to install via `sensu-install` (Ruby Gems) |
 
 ### Sensu/RabbitMQ SSL certificate properties
 ``` yaml

+ 1 - 0
defaults/main.yml

@@ -42,6 +42,7 @@ sensu_include_plugins: true
 sensu_include_dashboard: false
 sensu_master: false
 sensu_user_name: sensu
+sensu_remote_plugins: ~
 
 # Sensu/RabbitMQ SSL certificate properties
 sensu_ssl_gen_certs: true

+ 18 - 0
docs/remote_plugins.md

@@ -0,0 +1,18 @@
+# Remote Plugin Deployment
+Deployment of remote plugins, via Ruby Gems, is exposed via the `sensu_remote_plugins` variable.  
+By default this variable evaluates to `~` (null). It should be set as a YAML list, like so:  
+``` yaml
+sensu_remote_plugins:
+  - graphite
+  - process-checks
+```
+This will install the `graphite` and `process-checks` plugins from [sensu-plugins.io](http://sensu-plugins.io/).  
+
+Specific versions of plugins can also be defined, as shown below:
+``` yaml
+sensu_remote_plugins:
+  - graphite
+  - process-checks:0.0.6
+```
+
+As with any Ansible variable, the `sensu_remote_plugins` list can be defined where you see fit!

+ 1 - 0
docs/role_variables.md

@@ -52,6 +52,7 @@ _Note: The above options are intended to provide users with flexibility. This al
 | `sensu_include_dashboard` | `false` | Determines whether to deploy the Uchiwa dashboard |
 | `sensu_master` | `false` | Determines if a node is to act as the Sensu "master" node |
 | `sensu_user_name`| sensu | The name of the Sensu service user |
+| `sensu_remote_plugins` | _undefined_ | Sensu plugins to install via `sensu-install` (Ruby Gems) |
 
 ### Sensu/RabbitMQ SSL certificate properties
 ``` yaml

+ 1 - 0
mkdocs.yml

@@ -12,6 +12,7 @@ pages:
   - [ 'single_master.md', 'Usage', 'Deploy the stack to a single node' ]
   - [ 'custom_client_config.md', 'Usage', 'Custom client configuration' ]
   - [ 'deploy_plugins.md', 'Usage', 'Deployment of handlers/filters/mutators' ]
+  - [ 'remote_plugins.md', 'Usage', 'Remote plugin deployment']
   - [ 'sensitive_info.md', 'Usage', 'Sensitive information in version control' ]
   - [ 'testing.md', 'Usage', 'Testing' ]
   - [ 'dynamic_data.md','Conventions','Dynamic data store' ]

+ 7 - 1
tasks/plugins.yml

@@ -10,6 +10,12 @@
       owner: "{{ sensu_user_name }}"
       group: "{{ sensu_group_name }}"
 
+  - name: Ensure any remote plugins defined are present
+    shell: sensu-install -p {{ item }}
+    with_items: sensu_remote_plugins
+    changed_when: false
+    when: sensu_remote_plugins > 0
+
   - name: Register available checks
     local_action: command ls {{ static_data_store }}/sensu/checks
     register: sensu_available_checks
@@ -63,4 +69,4 @@
     when: sensu_master
     with_lines:
       - ls {{ static_data_store }}/sensu/definitions | sed 's/\.j2//'
-    notify: restart sensu-api service
+    notify: restart sensu-server service