From 39c968b6d2f6f9f83ec80ac4fbf9f055ae1ee30c Mon Sep 17 00:00:00 2001 From: Saurabh Badhwar Date: Wed, 4 Apr 2018 13:38:27 +0530 Subject: [PATCH] Allow detecting if the disk is a SSD or HDD Signed-off-by: Saurabh Badhwar --- ansible/roles/detect-ssd/tasks/main.yaml | 14 ++++++++++++++ conf/sattune.yaml | 3 +++ 2 files changed, 17 insertions(+) create mode 100644 ansible/roles/detect-ssd/tasks/main.yaml create mode 100644 conf/sattune.yaml diff --git a/ansible/roles/detect-ssd/tasks/main.yaml b/ansible/roles/detect-ssd/tasks/main.yaml new file mode 100644 index 0000000..5201efc --- /dev/null +++ b/ansible/roles/detect-ssd/tasks/main.yaml @@ -0,0 +1,14 @@ +--- + - debug: + msg: "Checking if the disk {{ satellite_physical_disk }} is SSD" + - name: Retrieve the contents of the disk + shell: + cat "/sys/block/{{ satellite_physical_disk }}/queue/rotational + register: is_ssd + - set_fact: + ssd: true + when: "{{ is_ssd.stdout | int }}" == 0 + - set_fact: + ssd: false + when: "{{ is_ssd.stdout | int }}" == 1 +... diff --git a/conf/sattune.yaml b/conf/sattune.yaml new file mode 100644 index 0000000..7dab6ba --- /dev/null +++ b/conf/sattune.yaml @@ -0,0 +1,3 @@ +--- +satellite_physical_disk: /dev/sda +...