From 4b70700526346f11a35e0cfa5b26ebe74e24245a Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Fri, 28 May 2021 22:36:51 +0200 Subject: [PATCH] [mtail] More configuration to select what should be monitored Signed-off-by: Yohann D'ANELLO --- group_vars/mtail.yml | 6 ++++++ host_vars/tealc.adm.crans.org.yml | 6 ++++++ hosts | 4 ++++ plays/monitoring.yml | 3 ++- roles/mtail/tasks/main.yml | 11 ++++++++--- 5 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 group_vars/mtail.yml diff --git a/group_vars/mtail.yml b/group_vars/mtail.yml new file mode 100644 index 00000000..e445bd9b --- /dev/null +++ b/group_vars/mtail.yml @@ -0,0 +1,6 @@ +--- +glob_mtail: + config: + - dhcpd.mtail + - radiusd.mtail + remove: [] diff --git a/host_vars/tealc.adm.crans.org.yml b/host_vars/tealc.adm.crans.org.yml index 5a0fdfad..1f116850 100644 --- a/host_vars/tealc.adm.crans.org.yml +++ b/host_vars/tealc.adm.crans.org.yml @@ -56,3 +56,9 @@ loc_rsyslog_server: vars: - name: InputRELPServerRun value: 20514 + +loc_mtail: + config: + - dhcpd.mtail + remove: + - radiusd.mtail diff --git a/hosts b/hosts index 65f11aec..d1946d3c 100644 --- a/hosts +++ b/hosts @@ -105,6 +105,10 @@ linx.adm.crans.org [mailman] mailman.adm.crans.org +[mtail] +gulp.cachan-adm.crans.org +tealc.adm.crans.org + [prometheus] monitoring.adm.crans.org fyre.cachan-adm.crans.org diff --git a/plays/monitoring.yml b/plays/monitoring.yml index 1f9dd30f..c1811033 100755 --- a/plays/monitoring.yml +++ b/plays/monitoring.yml @@ -44,9 +44,10 @@ # roles: ["prometheus-node-exporter-postfix"] # Monitor logs with mtail -- hosts: tealc.adm.crans.org,gulp.cachan-adm.crans.org +- hosts: mtail vars: mirror: '{{ glob_mirror | default({}) | combine(loc_mirror | default({})) }}' + mtail: '{{ glob_mtail | default({}) | combine(loc_mtail | default({})) }}' roles: - mtail diff --git a/roles/mtail/tasks/main.yml b/roles/mtail/tasks/main.yml index 5a44c99b..c4d673cc 100644 --- a/roles/mtail/tasks/main.yml +++ b/roles/mtail/tasks/main.yml @@ -30,9 +30,14 @@ src: "mtail/{{ item }}.j2" dest: "/etc/mtail/{{ item }}" mode: 0644 - loop: - - dhcpd.mtail - - radiusd.mtail + loop: "{{ mtail.config }}" + notify: Restart mtail + +- name: Drop unusued configuration + file: + path: "/etc/mtail/{{ item }}" + state: absent + loop: "{{ mtail.remove }}" notify: Restart mtail - name: Indicate role in motd