Skip to content

Commit

Permalink
ansible-scylla-node: Improves "legacy" support for 'node-exporter'
Browse files Browse the repository at this point in the history
This patch improves how 'node_exporter_install' is called and how 'node-exporter' service is started.

Fixes: scylladb#249

Signed-off-by: Eduardo Benzecri <[email protected]>
  • Loading branch information
ebenzecri committed Jun 16, 2023
1 parent 998643f commit 5ee7738
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
19 changes: 14 additions & 5 deletions ansible-scylla-node/handlers/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,21 @@
name: scylla-server
state: stopped

- name: node_exporter start
- 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
service:
name: node-exporter
state: started
enabled: yes

- name: Enable and start 'scylla-node-exporter.service' service
block:
Expand Down
10 changes: 5 additions & 5 deletions ansible-scylla-node/tasks/common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,15 @@
become: true
when: skip_ntp is defined and skip_ntp|bool == false

- name: node exporter setup
- name: Run 'node_exporter_install' (legacy)
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
- Enable and start 'node-exporter.service' service (legacy)
when:
- install_type == 'online'
- ansible_facts.services["scylla-node-exporter.service"] is not defined

- name: configure Scylla
shell: |
Expand Down

0 comments on commit 5ee7738

Please sign in to comment.