From 9b7c3b9003fef6f00bd23fd49301b2ea1b2ada9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gardais=20J=C3=A9r=C3=A9my?= Date: Wed, 16 May 2018 14:45:18 +0200 Subject: [PATCH] Ensure to apply the config only if wanted --- CHANGELOG.md | 1 + tasks/main.yml | 29 +++++++++++++++++++---------- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ed8be90..f5f52d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ## Enhancements * Ensure to not override groups of 'xymon' user. * Add possibility to install `apt` plugin dependencies. +* Ensure to apply the config only if wanted. ## v1.1 diff --git a/tasks/main.yml b/tasks/main.yml index 3d35cd9..6ca711b 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -15,7 +15,7 @@ state: '{{ xymon_cli_pkg_state }}' with_items: - '{{ xymon_cli_pkg_list }}' - when: xymon_cli_manage + when: xymon_cli_manage|bool - name: CONFIG xymon-client service template: @@ -25,7 +25,7 @@ group: root mode: 0644 backup: true - when: xymon_cli_manage + when: xymon_cli_manage|bool notify: restart xymon-client service - name: CONFIG xymon user's groups @@ -33,6 +33,7 @@ name: xymon groups: '{{ xymon_user_groups }}' append: True + when: xymon_cli_manage|bool notify: restart xymon-client service ## service @@ -41,7 +42,8 @@ name: '{{ xymon_cli_service_name }}' state: started enabled: '{{ xymon_cli_service_enabled }}' - when: xymon_cli_service_manage + when: (xymon_cli_manage|bool and + xymon_cli_service_manage|bool) # }}} # plugins {{{ @@ -51,7 +53,8 @@ state: '{{ "present" if xymon_plug_apt_state else "absent" }}' with_items: - '{{ xymon_plug_apt_package }}' - when: xymon_plug_manage + when: (xymon_cli_manage|bool and + xymon_plug_manage|bool) notify: restart xymon-client service - name: PLUGIN apt @@ -61,7 +64,8 @@ owner: root group: root mode: 0644 - when: xymon_plug_manage + when: (xymon_cli_manage|bool and + xymon_plug_manage|bool) notify: restart xymon-client service - name: PLUGIN mq packages @@ -70,7 +74,8 @@ state: '{{ "present" if xymon_plug_mq_state else "absent" }}' with_items: - '{{ xymon_plug_mq_package }}' - when: xymon_plug_manage + when: (xymon_cli_manage|bool and + xymon_plug_manage|bool) notify: restart xymon-client service - name: PLUGIN mq @@ -80,7 +85,8 @@ owner: root group: root mode: 0644 - when: xymon_plug_manage + when: (xymon_cli_manage|bool and + xymon_plug_manage|bool) notify: restart xymon-client service - name: PLUGIN libs packages @@ -89,7 +95,8 @@ state: '{{ "present" if xymon_plug_libs_state else "absent" }}' with_items: - '{{ xymon_plug_libs_package }}' - when: xymon_plug_manage + when: (xymon_cli_manage|bool and + xymon_plug_manage|bool) notify: restart xymon-client service - name: PLUGIN libs @@ -99,7 +106,8 @@ owner: root group: root mode: 0644 - when: xymon_plug_manage + when: (xymon_cli_manage|bool and + xymon_plug_manage|bool) notify: restart xymon-client service - name: PLUGIN libs whitelist @@ -109,7 +117,8 @@ owner: root group: root mode: 0644 - when: xymon_plug_manage + when: (xymon_cli_manage|bool and + xymon_plug_manage|bool) notify: restart xymon-client service # }}}