Jonathan Hart | 93956f5 | 2017-08-22 13:12:42 -0700 | [diff] [blame^] | 1 | |
| 2 | # Copyright 2017-present Open Networking Foundation |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | |
| 16 | |
Amir Zeidner | 34380a5 | 2017-04-26 10:48:44 +0300 | [diff] [blame] | 17 | --- |
| 18 | - name: Mellanox Constants |
| 19 | set_fact: |
| 20 | MLNX_PACK_VER: "mlnx-en-4.0-2.0.0.1-ubuntu14.04-x86_64" |
| 21 | MLNX_URL_PATH: "MLNX_EN-4.0-2.0.0.1" |
| 22 | MD5_MLNX: "b1581e2445c7832ec096b367e78303aa" |
| 23 | |
| 24 | - name: Install Prerequesites |
| 25 | become: yes |
| 26 | apt: name={{ item }} state=installed |
| 27 | with_items: |
| 28 | - debhelper |
| 29 | - autotools-dev |
| 30 | - dkms |
| 31 | - zlib1g-dev |
| 32 | - make |
| 33 | - python-libxml2 |
| 34 | - m4 |
| 35 | - automake |
| 36 | - autoconf |
| 37 | - libltdl-dev |
| 38 | - chrpath |
| 39 | - swig |
| 40 | - quilt |
| 41 | - graphviz |
| 42 | - dpatch |
| 43 | - gcc |
| 44 | |
| 45 | - name: Check Mellanox install package |
| 46 | become: yes |
| 47 | stat: |
| 48 | path: "{{ playbook_dir }}/roles/compute-node/files/{{MLNX_PACK_VER}}.tgz" |
| 49 | register: mlnx_package_exists |
| 50 | |
| 51 | - name: Download mlnx driver package |
| 52 | become: yes |
| 53 | local_action: > |
| 54 | get_url url="http://www.mellanox.com/downloads/ofed/{{MLNX_URL_PATH}}/{{MLNX_PACK_VER}}.tgz" |
| 55 | dest="{{ playbook_dir }}/roles/compute-node/files" |
| 56 | checksum="md5:{{MD5_MLNX}}" |
| 57 | when: mlnx_package_exists.stat.exists == False |
| 58 | |
| 59 | - name: Unarchive mlnx driver package |
| 60 | unarchive: |
| 61 | copy=yes |
| 62 | src="{{ playbook_dir }}/roles/compute-node/files/{{MLNX_PACK_VER}}.tgz" |
| 63 | dest=/tmp |
| 64 | |
| 65 | - name: Install mlnx driver |
| 66 | become: yes |
| 67 | command: /tmp/{{MLNX_PACK_VER}}/install --force |
| 68 | changed_when: true |
| 69 | |
| 70 | - name: Load mlnx Driver |
David K. Bainbridge | a826906 | 2017-05-18 11:43:56 -0700 | [diff] [blame] | 71 | become: yes |
Amir Zeidner | 34380a5 | 2017-04-26 10:48:44 +0300 | [diff] [blame] | 72 | command: /etc/init.d/mlnx-en.d restart |
| 73 | changed_when: true |
| 74 | |
| 75 | - name: Remove Build Directory |
| 76 | become: yes |
| 77 | file: |
| 78 | path=/tmp/{{MLNX_PACK_VER}} |
| 79 | state=absent |
| 80 | |
| 81 | - name: Remove Build files |
| 82 | become: yes |
| 83 | file: |
| 84 | path=/tmp/{{MLNX_PACK_VER}}.tgz |
| 85 | state=absent |
| 86 | |
| 87 | - name: Remove Mellanox Service files |
| 88 | become: yes |
| 89 | file: |
| 90 | path=/etc/init/mlnx-en.conf |
| 91 | state=absent |
| 92 | |
| 93 | - name: Remove Mellanox Init Script |
| 94 | become: yes |
| 95 | file: |
| 96 | path=/etc/init.d/mlnx-en.d |
| 97 | state=absent |