]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-cm-ansible.git/commitdiff
common: Install nvme-cli for use with smart.sh
authorDavid Galloway <dgallowa@redhat.com>
Thu, 13 Apr 2017 18:40:55 +0000 (14:40 -0400)
committerDavid Galloway <dgallowa@redhat.com>
Thu, 13 Apr 2017 19:40:52 +0000 (15:40 -0400)
Signed-off-by: David Galloway <dgallowa@redhat.com>
roles/common/tasks/disk_monitoring.yml

index 0cf7bcfa8eeab7ca3e6d316970a0619e536f3fe0..7ef34b73241535bdc8abe9bd82a1570aea271784 100644 (file)
     - smart.sh
     - raid.pl
     - diskusage.pl
+
+- name: Check for NVMe devices
+  shell: "cat /proc/partitions | grep -q nvme"
+  register: found_nvme
+  failed_when: false
+  changed_when: false
+
+- name: Install dependencies to clone and build nvme-cli
+  package:
+    name: "{{ item }}"
+    state: installed
+  when: found_nvme.rc == 0
+  with_items:
+    - git
+    - gcc
+
+# The upstream version is significantly newer than the packages provided
+# in CentOS and Xenial repos
+- name: Clone or update nvme-cli when NVMe devices detected
+  git:
+    repo: "https://github.com/linux-nvme/nvme-cli.git"
+    dest: "/usr/libexec/nvme-cli"
+    update: yes
+    force: yes
+  register: nvme_cli_git
+  when: found_nvme.rc == 0
+
+- name: Check for nvme-cli executable
+  stat:
+    path: "/usr/libexec/nvme-cli/nvme"
+  register: nvme_executable
+
+- name: Compile or recompile nvme-cli if needed
+  make:
+    chdir: "/usr/libexec/nvme-cli"
+  when: nvme_cli_git|changed or nvme_executable.stat.exists == false