aboutsummaryrefslogtreecommitdiffstats
path: root/fdio.infra.ansible/roles/mellanox
diff options
context:
space:
mode:
authorpmikus <pmikus@cisco.com>2021-04-08 10:44:18 +0000
committerPeter Mikus <pmikus@cisco.com>2021-04-08 11:17:15 +0000
commitdf5672b3d9c29b51397f4770eb992c9f3f3955ce (patch)
treeadb4cf36c9b680ebbc44c953391a0d21b986d6b7 /fdio.infra.ansible/roles/mellanox
parent8018da98e0f362bc69fc9600fac222a86fd46b5e (diff)
Ansible git move
+ Better accessibility + Compliant with fdio.infra._function_ - function [pxe|terraform|ansible|vagrant] + dill==0.3.3 also applied on TBs - ci-man to follow today - Docs to be updated in separate patch Signed-off-by: pmikus <pmikus@cisco.com> Change-Id: Iff9eaa29d63044188cc8160db2d9b44b7635782a
Diffstat (limited to 'fdio.infra.ansible/roles/mellanox')
-rw-r--r--fdio.infra.ansible/roles/mellanox/defaults/main.yaml21
-rw-r--r--fdio.infra.ansible/roles/mellanox/tasks/main.yaml67
2 files changed, 88 insertions, 0 deletions
diff --git a/fdio.infra.ansible/roles/mellanox/defaults/main.yaml b/fdio.infra.ansible/roles/mellanox/defaults/main.yaml
new file mode 100644
index 0000000000..0961ec7df6
--- /dev/null
+++ b/fdio.infra.ansible/roles/mellanox/defaults/main.yaml
@@ -0,0 +1,21 @@
+---
+# file: roles/mellanox/defaults/main.yaml
+
+packages: "{{ packages_base + packages_by_distro[ansible_distribution | lower] + packages_by_arch[ansible_machine] }}"
+
+packages_base:
+ - []
+
+packages_by_distro:
+ ubuntu:
+ - "build-essential"
+ - "libnl-3-dev"
+ - "libnl-route-3-dev"
+
+packages_by_arch:
+ aarch64:
+ - []
+ x86_64:
+ - []
+
+mellanox_version: "5.2-1.0.4.0" \ No newline at end of file
diff --git a/fdio.infra.ansible/roles/mellanox/tasks/main.yaml b/fdio.infra.ansible/roles/mellanox/tasks/main.yaml
new file mode 100644
index 0000000000..670282923a
--- /dev/null
+++ b/fdio.infra.ansible/roles/mellanox/tasks/main.yaml
@@ -0,0 +1,67 @@
+---
+# file: roles/mellanox/tasks/main.yaml
+
+- name: Inst - Update Package Cache (APT)
+ apt:
+ update_cache: yes
+ cache_valid_time: 3600
+ when:
+ - ansible_distribution|lower == 'ubuntu'
+ tags:
+ - mellanox-inst-prerequisites
+
+- name: Inst - Prerequisites
+ package:
+ name: "{{ packages | flatten(levels=1) }}"
+ state: latest
+ tags:
+ - mellanox-inst-prerequisites
+
+- name: Inst - Check Presence of Mellanox Hardware
+ shell: "lspci | grep Mellanox | awk '{print $1}'"
+ register: mellanox_pcis
+ failed_when: no
+ changed_when: no
+ tags:
+ - mellanox-inst
+
+- name: Inst - Get OFED
+ get_url:
+ url: "http://content.mellanox.com/ofed/MLNX_OFED-{{ mellanox_version }}/MLNX_OFED_LINUX-{{ mellanox_version }}-{{ ansible_distribution|lower }}{{ ansible_distribution_version }}-{{ ansible_machine }}.tgz"
+ dest: "/opt/MLNX_OFED_LINUX-{{ mellanox_version }}-{{ ansible_distribution|lower }}{{ ansible_distribution_version }}-{{ ansible_machine }}.tgz"
+ mode: 0644
+ when: mellanox_pcis.stdout_lines | length > 0
+ tags:
+ - mellanox-inst
+
+- name: Inst - Extract OFED
+ unarchive:
+ remote_src: true
+ src: "/opt/MLNX_OFED_LINUX-{{ mellanox_version }}-{{ ansible_distribution|lower }}{{ ansible_distribution_version }}-{{ ansible_machine }}.tgz"
+ dest: "/opt/"
+ creates: "/opt/MLNX_OFED_LINUX-{{ mellanox_version }}-{{ ansible_distribution|lower }}{{ ansible_distribution_version }}-{{ ansible_machine }}"
+ register: mellanox_firmware_extracted
+ when: mellanox_pcis.stdout_lines | length > 0
+ tags:
+ - mellanox-inst
+
+- name: Inst - OFED
+ command: "./mlnxofedinstall --with-mft --dpdk --force --upstream-libs"
+ args:
+ chdir: "/opt/MLNX_OFED_LINUX-{{ mellanox_version }}-{{ ansible_distribution|lower }}{{ ansible_distribution_version }}-{{ ansible_machine }}"
+ when: mellanox_pcis.stdout_lines | length > 0 and mellanox_firmware_extracted
+ tags:
+ - mellanox-inst
+
+- name: Switch Infiniband to Ethernet
+ command: "mlxconfig --yes --dev {{ item }} set LINK_TYPE_P1=2 LINK_TYPE_P2=2"
+ with_items: "{{ mellanox_pcis.stdout_lines }}"
+ tags:
+ - mellanox-conf
+
+- name: FIX qemu-system removal
+ package:
+ name: "qemu-system"
+ state: latest
+ tags:
+ - mellanox-inst