From b352844e5e04acaf4a011af3d873018d9bebc9a9 Mon Sep 17 00:00:00 2001 From: Vincent Reniers Date: Tue, 5 Nov 2024 12:03:35 +0200 Subject: [PATCH] ansible-scylla-node: auto-detect NVMe: only use non-mounted disks. NVMe disks should only be selected that are not in use, which should be the case when they are not mounted. Fixes #407 Signed-off-by: Vincent Reniers --- ansible-scylla-node/defaults/main.yml | 1 - ansible-scylla-node/tasks/RedHat.yml | 5 ----- ansible-scylla-node/tasks/common.yml | 11 +++++++++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/ansible-scylla-node/defaults/main.yml b/ansible-scylla-node/defaults/main.yml index dae0822f..cafa0336 100644 --- a/ansible-scylla-node/defaults/main.yml +++ b/ansible-scylla-node/defaults/main.yml @@ -192,7 +192,6 @@ scylla_dependencies: - curl - wget - python3-yaml # this will fail on non centos systems - - nvme-cli #- software-properties-common #- apt-transport-https #- gnupg2 diff --git a/ansible-scylla-node/tasks/RedHat.yml b/ansible-scylla-node/tasks/RedHat.yml index ae4753d7..d1c6a44f 100644 --- a/ansible-scylla-node/tasks/RedHat.yml +++ b/ansible-scylla-node/tasks/RedHat.yml @@ -120,11 +120,6 @@ for i in `yum search python3|grep -i pyyaml|awk '{ print $1 }'`; do sudo yum -y install $i; done become: true -- name: install nvme-cli - shell: | - yum install -y nvme-cli - become: true - - name: install and configure Scylla Manager Agent block: - name: add Scylla Manager repo diff --git a/ansible-scylla-node/tasks/common.yml b/ansible-scylla-node/tasks/common.yml index f0aca974..86b05d05 100644 --- a/ansible-scylla-node/tasks/common.yml +++ b/ansible-scylla-node/tasks/common.yml @@ -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 $(lsblk -oNAME -nd | grep nvme) + do + { echo -n "/dev/$nvme_disk "; lsblk "/dev/$nvme_disk" -o MOUNTPOINT | grep / | wc -l; } | awk '{if ($2=="0") print $1}' + done register: _detected_nvmes - set_fact: @@ -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