Last active
February 21, 2020 15:19
-
-
Save lazyfrosch/27c413f270fd139efce4a27e0538a1e7 to your computer and use it in GitHub Desktop.
Ansible Icinga Plugin constants
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: Icinga 2 const | |
hosts: | |
- test | |
tasks: | |
- name: Determine PluginDir for default | |
set_fact: | |
icinga2_plugin_dir: /usr/lib/nagios/plugins | |
- name: Determine PluginDir for RedHat | |
set_fact: | |
icinga2_plugin_dir: /usr/lib64/nagios/plugins | |
when: ansible_facts['os_family'] == "RedHat" | |
- name: Ensure correct PluginDir is set | |
lineinfile: | |
path: /etc/icinga2/constants.conf | |
regexp: '^const PluginDir' | |
line: 'const PluginDir = "{{ icinga2_plugin_dir }}"' | |
- name: Ensure correct PluginContribDir is set | |
lineinfile: | |
path: /etc/icinga2/constants.conf | |
regexp: '^const PluginContribDir' | |
line: 'const PluginContribDir = "{{ icinga2_plugin_dir }}/contrib"' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PLAY [Icinga 2 const] *************************************************************************************************************************************************************** | |
TASK [Gathering Facts] ************************************************************************************************************************************************************** | |
ok: [centos-2gb-nbg1-2] | |
TASK [Determine PluginDir for default] ********************************************************************************************************************************************** | |
ok: [centos-2gb-nbg1-2] | |
TASK [Determine PluginDir for RedHat] *********************************************************************************************************************************************** | |
ok: [centos-2gb-nbg1-2] | |
TASK [Ensure correct PluginDir is set] ********************************************************************************************************************************************** | |
ok: [centos-2gb-nbg1-2] | |
TASK [Ensure correct PluginContribDir is set] *************************************************************************************************************************************** | |
--- before: /etc/icinga2/constants.conf (content) | |
+++ after: /etc/icinga2/constants.conf (content) | |
@@ -14,7 +14,7 @@ | |
/* The directory which you use to store additional plugins which ITL provides user contributed command definitions for. | |
* Check the documentation, chapter "Plugins Contribution", for details. | |
*/ | |
-const PluginContribDir = "/usr/lib64/nagios/plugins" | |
+const PluginContribDir = "/usr/lib64/nagios/plugins/contrib" | |
/* Our local instance name. By default this is the server's hostname as returned by `hostname --fqdn`. | |
* This should be the common name from the API certificate. | |
changed: [centos-2gb-nbg1-2] | |
PLAY RECAP ************************************************************************************************************************************************************************** | |
centos-2gb-nbg1-2 : ok=5 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment