Skip to content

Commit

Permalink
ansible-scylla-node: auto-detect NVMe: only use non-mounted disks.
Browse files Browse the repository at this point in the history
NVMe disks should only be selected that are not in use, which should be the case when they are not mounted.
Fixes #407
  • Loading branch information
vreniers authored and vladzcloudius committed Jan 28, 2025
1 parent b564efd commit 9ee032d
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions ansible-scylla-node/tasks/common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,12 @@

- name: Detect NVME disks
block:
- name: Get list of NVMEs
- name: Get list of NVMEs with no mount points
shell: |
nvme list | awk '{print $1}' | tail -n +3
for nvme_disk in $(nvme list | awk '{print $1}' | tail -n +3)
do
{ echo -n "$nvme_disk "; lsblk -n "$nvme_disk" -o MOUNTPOINT | grep / | wc -l; } | awk '{if ($2=="0") print $1}'
done
register: _detected_nvmes

- set_fact:
Expand Down Expand Up @@ -80,6 +83,10 @@
_disable_online_discard: "--online-discard {{ scylla_raid_online_discard }}"
when: _scylla_raid_setup_help.stdout is search("--online-discard")

- name: "ansible-scylla-node: common.yml: Setting raid setup with disks"
debug:
msg: "Using the following disk devices: {{ scylla_raid_setup | join(',') }}"

- name: run raid setup if there is no scylla mount yet
shell: "scylla_raid_setup --disks {{ scylla_raid_setup | join(',') }} --update-fstab {{ _disable_online_discard }}"
become: true
Expand Down

0 comments on commit 9ee032d

Please sign in to comment.