From 7452615e66deb57e6fc3df81f8c206dfaa37fea0 Mon Sep 17 00:00:00 2001 From: Eduardo Benzecri Date: Wed, 21 Jun 2023 09:57:32 -0300 Subject: [PATCH] ansible-scylla-node: Improves "legacy" support for 'node-exporter' This patch improves how 'node_exporter_install' is called and how 'node-exporter' service is started. Fixes: #249 Signed-off-by: Eduardo Benzecri --- ansible-scylla-node/tasks/common.yml | 25 ++++++++----------- .../tasks/upgrade/post_upgrade.yml | 6 +++-- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/ansible-scylla-node/tasks/common.yml b/ansible-scylla-node/tasks/common.yml index e5ea5328..32c755c8 100644 --- a/ansible-scylla-node/tasks/common.yml +++ b/ansible-scylla-node/tasks/common.yml @@ -114,23 +114,20 @@ become: true when: skip_ntp is defined and skip_ntp|bool == false -- name: node exporter setup - shell: | +- name: Check if 'node_exporter_install' exists (legacy) + ansible.builtin.stat: + path: /usr/sbin/node_exporter_install + register: node_exporter_install + +- name: Run 'node_exporter_install' (legacy) + ansible.builtin.shell: | node_exporter_install --force - when: install_type == 'online' become: true notify: - - 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 + - Enable and start 'node-exporter.service' service (legacy) + when: + - install_type == 'online' + - node_exporter_install.stat.exists - 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 e97b678e..b0176594 100644 --- a/ansible-scylla-node/tasks/upgrade/post_upgrade.yml +++ b/ansible-scylla-node/tasks/upgrade/post_upgrade.yml @@ -5,6 +5,8 @@ ansible.builtin.service: name: scylla-server state: started - notify: scylla-manager-agent restart + notify: + - scylla-manager-agent restart + - Enable and start 'node-exporter.service' service (legacy) + - Enable and start 'scylla-node-exporter.service' service become: true -