From 2e76f7b5375e27b5a60756bb83470dfe04ed2e42 Mon Sep 17 00:00:00 2001 From: Sven Velt Date: Tue, 2 Oct 2018 22:44:11 +0200 Subject: [PATCH] Feature: Copy custom plugins Variables: - monitored_plugins_custom: list of plugins - monitored_plugins_custom_path: destination path --- .gitignore | 2 ++ defaults/main.yml | 2 ++ files/plugins_custom/.PUT_YOUR_OWN_PLUGINS_HERE | 0 tasks/main.yml | 4 ++++ tasks/plugins_custom.yml | 11 +++++++++++ 5 files changed, 19 insertions(+) create mode 100644 files/plugins_custom/.PUT_YOUR_OWN_PLUGINS_HERE create mode 100644 tasks/plugins_custom.yml diff --git a/.gitignore b/.gitignore index 98a3264..1c22cce 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +files/plugins_custom/ + .*.sw? *~ diff --git a/defaults/main.yml b/defaults/main.yml index fd2495e..f27e065 100644 --- a/defaults/main.yml +++ b/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 diff --git a/files/plugins_custom/.PUT_YOUR_OWN_PLUGINS_HERE b/files/plugins_custom/.PUT_YOUR_OWN_PLUGINS_HERE new file mode 100644 index 0000000..e69de29 diff --git a/tasks/main.yml b/tasks/main.yml index 4498cb7..f28a43c 100644 --- a/tasks/main.yml +++ b/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 diff --git a/tasks/plugins_custom.yml b/tasks/plugins_custom.yml new file mode 100644 index 0000000..6130dc3 --- /dev/null +++ b/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 }}" + +