浏览代码

Feature: Copy custom plugins

Variables:
- monitored_plugins_custom: list of plugins
- monitored_plugins_custom_path: destination path
Sven Velt 6 年之前
父节点
当前提交
2e76f7b537
共有 5 个文件被更改,包括 19 次插入0 次删除
  1. 2 0
      .gitignore
  2. 2 0
      defaults/main.yml
  3. 0 0
      files/plugins_custom/.PUT_YOUR_OWN_PLUGINS_HERE
  4. 4 0
      tasks/main.yml
  5. 11 0
      tasks/plugins_custom.yml

+ 2 - 0
.gitignore

@@ -1,3 +1,5 @@
+files/plugins_custom/
+
 .*.sw?
 *~
 

+ 2 - 0
defaults/main.yml

@@ -13,6 +13,8 @@ monitored_packages_additional: []
 monitored_packages_additional_nrpe: []
 monitored_packages_additional_ssh: []
 
+monitored_plugins_custom_path: /usr/local/plugins/
+
 monitored_nrpe_server_address: null
 monitored_nrpe_port: 5666
 

+ 0 - 0
files/plugins_custom/.PUT_YOUR_OWN_PLUGINS_HERE


+ 4 - 0
tasks/main.yml

@@ -26,6 +26,10 @@
   include_tasks: packages.yml
   when: monitored_packages_install != False
 
+- name: "INCLUDE: Copy custom plugins"
+  include_tasks: plugins_custom.yml
+  when: monitored_plugins_custom|default([]) != []
+
 - name: "INCLUDE: Monitoring by NRPE"
   include_tasks: nrpe.yml
   when: monitored_by_nrpe == True

+ 11 - 0
tasks/plugins_custom.yml

@@ -0,0 +1,11 @@
+---
+- name: Copy custom plugins
+  copy:
+    src: "plugins_custom/{{ item }}"
+    dest: "{{ monitored_plugins_custom_path }}"
+    owner: root
+    group: "{{ monitored_group }}"
+    mode: 0750
+  with_items: "{{ monitored_plugins_custom }}"
+
+