Adding support for Mellanox NIC ConnectX-4 and newer
Change-Id: Ia5d93c23d982e430b54de2116c9b526a9bf1f59e
diff --git a/roles/compute-node/tasks/main.yml b/roles/compute-node/tasks/main.yml
index d17945f..57c120f 100644
--- a/roles/compute-node/tasks/main.yml
+++ b/roles/compute-node/tasks/main.yml
@@ -157,9 +157,9 @@
- post-fabric-config
- pull-latest-docker-images
-- name: Verify Mellanox 40Gb NIC
- shell: /usr/bin/lspci | grep "Ethernet controller" | grep -c ConnectX-3 || true
- register: mlx_nic_present
+- name: Verify Mellanox NICs
+ shell: /usr/bin/lspci | grep "Ethernet controller" | grep -c Mellanox || true
+ register: mlnx_nic_present
changed_when: False
- name: Verify Intel 40Gb NIC
@@ -176,18 +176,18 @@
tags:
- interface_config
-- name: Verify mlx4 Driver
- command: modinfo --field=version mlx4_core
- register: mlx4_version
- when: mlx_nic_present.stdout != "0"
+- name: Verify Mellanox Driver
+ command: modinfo --field=version mlx5_core
+ register: mlnx5_version
+ when: mlnx_nic_present.stdout != "0"
changed_when: False
failed_when: False
tags:
- interface_config
-- name: Update mlx4 Driver
- include: mlx4_driver.yml
- when: mlx_nic_present.stdout != "0" and mlx4_version.stdout != '3.1-1.0.4'
+- name: Update Mellanox Driver
+ include: mlnx_driver.yml
+ when: mlnx_nic_present.stdout != "0" and mlnx5_version.stdout != '4.0-2.0.0'
tags:
- interface_config
diff --git a/roles/compute-node/tasks/mlnx_driver.yml b/roles/compute-node/tasks/mlnx_driver.yml
new file mode 100644
index 0000000..728ebb4
--- /dev/null
+++ b/roles/compute-node/tasks/mlnx_driver.yml
@@ -0,0 +1,80 @@
+---
+- name: Mellanox Constants
+ set_fact:
+ MLNX_PACK_VER: "mlnx-en-4.0-2.0.0.1-ubuntu14.04-x86_64"
+ MLNX_URL_PATH: "MLNX_EN-4.0-2.0.0.1"
+ MD5_MLNX: "b1581e2445c7832ec096b367e78303aa"
+
+- name: Install Prerequesites
+ become: yes
+ apt: name={{ item }} state=installed
+ with_items:
+ - debhelper
+ - autotools-dev
+ - dkms
+ - zlib1g-dev
+ - make
+ - python-libxml2
+ - m4
+ - automake
+ - autoconf
+ - libltdl-dev
+ - chrpath
+ - swig
+ - quilt
+ - graphviz
+ - dpatch
+ - gcc
+
+- name: Check Mellanox install package
+ become: yes
+ stat:
+ path: "{{ playbook_dir }}/roles/compute-node/files/{{MLNX_PACK_VER}}.tgz"
+ register: mlnx_package_exists
+
+- name: Download mlnx driver package
+ become: yes
+ local_action: >
+ get_url url="http://www.mellanox.com/downloads/ofed/{{MLNX_URL_PATH}}/{{MLNX_PACK_VER}}.tgz"
+ dest="{{ playbook_dir }}/roles/compute-node/files"
+ checksum="md5:{{MD5_MLNX}}"
+ when: mlnx_package_exists.stat.exists == False
+
+- name: Unarchive mlnx driver package
+ unarchive:
+ copy=yes
+ src="{{ playbook_dir }}/roles/compute-node/files/{{MLNX_PACK_VER}}.tgz"
+ dest=/tmp
+
+- name: Install mlnx driver
+ become: yes
+ command: /tmp/{{MLNX_PACK_VER}}/install --force
+ changed_when: true
+
+- name: Load mlnx Driver
+ command: /etc/init.d/mlnx-en.d restart
+ changed_when: true
+
+- name: Remove Build Directory
+ become: yes
+ file:
+ path=/tmp/{{MLNX_PACK_VER}}
+ state=absent
+
+- name: Remove Build files
+ become: yes
+ file:
+ path=/tmp/{{MLNX_PACK_VER}}.tgz
+ state=absent
+
+- name: Remove Mellanox Service files
+ become: yes
+ file:
+ path=/etc/init/mlnx-en.conf
+ state=absent
+
+- name: Remove Mellanox Init Script
+ become: yes
+ file:
+ path=/etc/init.d/mlnx-en.d
+ state=absent
diff --git a/roles/compute-node/tasks/mlx4_driver.yml b/roles/compute-node/tasks/mlx4_driver.yml
deleted file mode 100644
index a9b76f0..0000000
--- a/roles/compute-node/tasks/mlx4_driver.yml
+++ /dev/null
@@ -1,44 +0,0 @@
----
-- name: Install Prerequesites
- become: yes
- apt: name={{ item }} state=installed
- with_items:
- - debhelper
- - autotools-dev
- - dkms
- - zlib1g-dev
-
-- name: Unarchive mlx4 driver package
- unarchive:
- copy=no
- src=http://www.mellanox.com/downloads/Drivers/mlnx-en-3.1-1.0.4.tgz
- dest=/tmp
-
-- name: Install mlx4 driver
- become: yes
- command: /tmp/mlnx-en-3.1-1.0.4/install.sh --batch
- changed_when: true
-
-- name: Remove Build Directory
- become: yes
- file:
- path=/tmp/mlnx-en-3.1-1.0.4
- state=absent
-
-- name: Remove Build files
- become: yes
- file:
- path=/tmp/mlnx-en-3.1-1.0.4.tgz
- state=absent
-
-- name: Remove Mellanox Service files
- become: yes
- file:
- path=/etc/init/mlnx-en.conf
- state=absent
-
-- name: Remove Mellanox Init Script
- become: yes
- file:
- path=/etc/init.d/mlnx-en.d
- state=absent