From 681cb1d301a104689fdad720f3a9955e00f3e91f Mon Sep 17 00:00:00 2001 From: Eduardo Benzecri Date: Fri, 16 Jun 2023 10:35:00 -0300 Subject: [PATCH] ansible-scylla-node: Enables and start 'scylla-node-exporter.service' service This patch enables and start 'scylla-node-exporter.service' service and disables and stop (if exists) 'node-exporter.service'. Fixes: #249 Signed-off-by: Eduardo Benzecri --- ansible-scylla-node/handlers/main.yml | 17 +++++++++++++++++ ansible-scylla-node/tasks/Debian.yml | 1 + ansible-scylla-node/tasks/RedHat.yml | 1 + ansible-scylla-node/tasks/common.yml | 8 -------- 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/ansible-scylla-node/handlers/main.yml b/ansible-scylla-node/handlers/main.yml index 31f0ad93..bfc3060a 100644 --- a/ansible-scylla-node/handlers/main.yml +++ b/ansible-scylla-node/handlers/main.yml @@ -31,6 +31,23 @@ state: started enabled: yes +- name: Enable and start 'scylla-node-exporter.service' service + block: + - name: Disable and stop 'node-exporter.service' service (legacy) + ansible.builtin.service: + name: node-exporter.service + state: stopped + enabled: no + when: ansible_facts.services["node-exporter.service"] is defined + + - name: Enable and start 'scylla-node-exporter.service' service + ansible.builtin.service: + name: scylla-node-exporter.service + state: started + enabled: yes + become: true + when: ansible_facts.services["scylla-node-exporter.service"] is defined + - name: Enable and start 'scylla-fstrim.timer' service ansible.builtin.service: name: scylla-fstrim.timer diff --git a/ansible-scylla-node/tasks/Debian.yml b/ansible-scylla-node/tasks/Debian.yml index 2b4bd157..244bc016 100644 --- a/ansible-scylla-node/tasks/Debian.yml +++ b/ansible-scylla-node/tasks/Debian.yml @@ -65,6 +65,7 @@ - name: Install Scylla packages include_tasks: Debian_install.yml become: true + notify: Enable and start 'scylla-node-exporter.service' service # TODO: Implement this for the debian based distros # - name: install prerequisite python-yaml diff --git a/ansible-scylla-node/tasks/RedHat.yml b/ansible-scylla-node/tasks/RedHat.yml index 9137360c..729f3ebf 100644 --- a/ansible-scylla-node/tasks/RedHat.yml +++ b/ansible-scylla-node/tasks/RedHat.yml @@ -111,6 +111,7 @@ lock_timeout: 60 when: scylla_version != 'latest' and scylla_edition == 'enterprise' become: true + notify: Enable and start 'scylla-node-exporter.service' service - name: Configure SELinux shell: | diff --git a/ansible-scylla-node/tasks/common.yml b/ansible-scylla-node/tasks/common.yml index e5ea5328..b2895c1f 100644 --- a/ansible-scylla-node/tasks/common.yml +++ b/ansible-scylla-node/tasks/common.yml @@ -124,14 +124,6 @@ ignore_errors: true #TODO: stop ignoring errors when the node_exporter_install script fix is available in all actual versions, resp. use only for < 5.0 / 2022 -- name: node exporter setup from 5.0/2022 - service: - name: scylla-node-exporter - state: started - become: true - ignore_errors: true - #TODO: stop ignoring errors when a version check is added - - name: configure Scylla shell: | scylla_setup --no-raid-setup --nic {{ scylla_nic }} --setup-nic-and-disks --no-ec2-check --no-kernel-check --no-ntp-setup --no-io-setup --no-node-exporter --no-coredump-setup --no-sysconfig-setup --no-swap-setup