Ansible: Mellanox install
[csit.git] / resources / tools / testbed-setup / ansible / roles / common / tasks / mellanox.yaml
1 ---
2 # file: roles/common/tasks/mellanox.yaml
3
4 - name: Mellanox Install - Check Presence of Mellanox Hardware
5   shell: "lspci | grep Mellanox | awk '{print $1}'"
6   register: mellanox_pcis
7   failed_when: no
8   changed_when: no
9   tags: install-mellanox
10
11 - name: Mellanox Install - Get OFED
12   get_url:
13     url: 'http://content.mellanox.com/ofed/MLNX_OFED-{{ mellanox.version }}/MLNX_OFED_LINUX-{{ mellanox.version }}-{{ ansible_distribution|lower }}{{ ansible_distribution_version }}-{{ ansible_machine }}.tgz'
14     dest: '/opt/MLNX_OFED_LINUX-{{ mellanox.version }}-{{ ansible_distribution|lower }}{{ ansible_distribution_version }}-{{ ansible_machine }}.tgz'
15     mode: 0644
16   when: mellanox_pcis.stdout_lines | length > 0
17   tags: install-mellanox
18
19 - name: Mellanox Install - Extract OFED
20   unarchive:
21     remote_src: true
22     src: '/opt/MLNX_OFED_LINUX-{{ mellanox.version }}-{{ ansible_distribution|lower }}{{ ansible_distribution_version }}-{{ ansible_machine }}.tgz'
23     dest: '/opt/'
24     creates: '/opt/MLNX_OFED_LINUX-{{ mellanox.version }}-{{ ansible_distribution|lower }}{{ ansible_distribution_version }}-{{ ansible_machine }}'
25   register: mellanox_firmware_extracted
26   when: mellanox_pcis.stdout_lines | length > 0
27   tags: install-mellanox
28
29 - name: Mellanox Install - Install OFED
30   command: './mlnxofedinstall --with-mft --dpdk --force --upstream-libs'
31   args:
32     chdir: '/opt/MLNX_OFED_LINUX-{{ mellanox.version }}-{{ ansible_distribution|lower }}{{ ansible_distribution_version }}-{{ ansible_machine }}'
33   when: mellanox_pcis.stdout_lines | length > 0 and mellanox_firmware_extracted
34   tags: install-mellanox
35
36 - name: Mellanox Install - Switch Infiniband to Ethernet
37   command: 'mlxconfig --yes --dev {{ item }} set LINK_TYPE_P1=2 LINK_TYPE_P2=2'
38   with_items: "{{ mellanox_pcis.stdout_lines }}"
39   tags: install-mellanox