From a829807e205b814312e8b2b1976eeff25924cee2 Mon Sep 17 00:00:00 2001 From: Igor Duarte Date: Tue, 20 Jun 2023 11:02:34 -0300 Subject: [PATCH] Revert "Improves 'scylla-node-exporter' related code" --- ansible-scylla-node/handlers/main.yml | 37 +++---------------- ansible-scylla-node/tasks/Debian.yml | 1 - ansible-scylla-node/tasks/RedHat.yml | 1 - ansible-scylla-node/tasks/common.yml | 18 ++++++--- .../tasks/upgrade/post_upgrade.yml | 5 +-- 5 files changed, 19 insertions(+), 43 deletions(-) diff --git a/ansible-scylla-node/handlers/main.yml b/ansible-scylla-node/handlers/main.yml index 671ab210..31f0ad93 100644 --- a/ansible-scylla-node/handlers/main.yml +++ b/ansible-scylla-node/handlers/main.yml @@ -24,39 +24,12 @@ name: scylla-server state: stopped -- name: Enable and start 'node-exporter.service' service (legacy) - block: - - name: Disable and stop 'scylla-node-exporter.service' service - ansible.builtin.service: - name: scylla-node-exporter.service - state: stopped - enabled: no - when: ansible_facts.services["scylla-node-exporter.service"] is defined - - - name: Enable and start 'node-exporter.service' service (legacy) - ansible.builtin.service: - name: node-exporter.service - state: started - enabled: yes - become: true - when: ansible_facts.services["node-exporter.service"] is defined - -- 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 +- name: node_exporter start become: true - when: ansible_facts.services["scylla-node-exporter.service"] is defined + service: + name: node-exporter + state: started + enabled: yes - name: Enable and start 'scylla-fstrim.timer' service ansible.builtin.service: diff --git a/ansible-scylla-node/tasks/Debian.yml b/ansible-scylla-node/tasks/Debian.yml index 244bc016..2b4bd157 100644 --- a/ansible-scylla-node/tasks/Debian.yml +++ b/ansible-scylla-node/tasks/Debian.yml @@ -65,7 +65,6 @@ - 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 729f3ebf..9137360c 100644 --- a/ansible-scylla-node/tasks/RedHat.yml +++ b/ansible-scylla-node/tasks/RedHat.yml @@ -111,7 +111,6 @@ 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 4e25d099..e5ea5328 100644 --- a/ansible-scylla-node/tasks/common.yml +++ b/ansible-scylla-node/tasks/common.yml @@ -114,15 +114,23 @@ become: true when: skip_ntp is defined and skip_ntp|bool == false -- name: Run 'node_exporter_install' (legacy) +- name: node exporter setup shell: | node_exporter_install --force + when: install_type == 'online' become: true notify: - - Enable and start 'node-exporter.service' service (legacy) - when: - - install_type == 'online' - - ansible_facts.services["scylla-node-exporter.service"] is not defined + - node_exporter start + 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: | diff --git a/ansible-scylla-node/tasks/upgrade/post_upgrade.yml b/ansible-scylla-node/tasks/upgrade/post_upgrade.yml index 0246bd67..e97b678e 100644 --- a/ansible-scylla-node/tasks/upgrade/post_upgrade.yml +++ b/ansible-scylla-node/tasks/upgrade/post_upgrade.yml @@ -5,9 +5,6 @@ ansible.builtin.service: name: scylla-server state: started - notify: - - scylla-manager-agent restart - - Enable and start 'node-exporter.service' service (legacy) - - Enable and start 'scylla-node-exporter.service' service + notify: scylla-manager-agent restart become: true