diff --git a/ansible-scylla-node/tasks/common.yml b/ansible-scylla-node/tasks/common.yml index 3dcbe519..73531666 100644 --- a/ansible-scylla-node/tasks/common.yml +++ b/ansible-scylla-node/tasks/common.yml @@ -156,24 +156,39 @@ become: true when: skip_ntp is defined and skip_ntp|bool == false -- name: node exporter setup +- name: check for node_exporter_install + stat: + path: /usr/sbin/node_exporter_install + register: node_exporter_install + +- name: setup legacy node exporter shell: | node_exporter_install --force - when: install_type == 'online' + when: (install_type == 'online') and (node_exporter_install.stat.exists) 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: check for node_exporter + stat: + path: /opt/scylladb/node_exporter/node_exporter + register: node_exporter + +- name: setup bundled node exporter + block: + - name: Enforce disabling of old node exporter + service: + name: node-exporter + state: stopped + when: ansible_facts.services['node-exporter.service'] is defined and (ansible_facts.services['node-exporter.service']["status"] != "not-found") + - name: Start bundled node exporter + service: name: scylla-node-exporter state: started enabled: yes + when: ansible_facts.services['scylla-node-exporter.service'] is defined and (ansible_facts.services['scylla-node-exporter.service']["status"] != "not-found") become: true - ignore_errors: true - #TODO: stop ignoring errors when a version check is added + when: node_exporter.stat.exists - name: configure scylla.yaml template: diff --git a/ansible-scylla-node/tasks/main.yml b/ansible-scylla-node/tasks/main.yml index 036e7a7d..a24a0665 100644 --- a/ansible-scylla-node/tasks/main.yml +++ b/ansible-scylla-node/tasks/main.yml @@ -2,7 +2,7 @@ # Facts gathering - name: Populate service facts - service_facts: + ansible.builtin.service_facts: - name: Populate package facts package_facts: