Skip to content

Commit

Permalink
scylla-node: remove ignore_errors, make node exporter from 2022 work
Browse files Browse the repository at this point in the history
2022 node exporter now works for clean install and upgrades

fix detection of node-exporter services

make sure the name of node exporter service matches the check
  • Loading branch information
tarzanek committed Feb 27, 2024
1 parent af92c08 commit a5093ff
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 9 deletions.
31 changes: 23 additions & 8 deletions ansible-scylla-node/tasks/common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion ansible-scylla-node/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Facts gathering
- name: Populate service facts
service_facts:
ansible.builtin.service_facts:

- name: Populate package facts
package_facts:
Expand Down

0 comments on commit a5093ff

Please sign in to comment.