From a17e51ea978db956785c3048a8e6ad4640adb7ff Mon Sep 17 00:00:00 2001 From: Chris Hines <chris.hines@monash.edu> Date: Thu, 21 Jul 2016 04:57:43 +0000 Subject: [PATCH] download mellanox drivers from our server Former-commit-id: 97055e9c4e8d44c93541227cf1fab724b94e90e5 --- roles/mellanox_drivers/tasks/main.yml | 110 +++----------------------- 1 file changed, 10 insertions(+), 100 deletions(-) diff --git a/roles/mellanox_drivers/tasks/main.yml b/roles/mellanox_drivers/tasks/main.yml index 9678d12e..32c06a8e 100644 --- a/roles/mellanox_drivers/tasks/main.yml +++ b/roles/mellanox_drivers/tasks/main.yml @@ -2,7 +2,7 @@ - include_vars: mellanoxVars.yml - name: yum install dependencies - yum: name=perl,pciutils,gtk2,atk,cairo,gcc-gfortran,libxml2-python,tcsh,libnl,lsof,tcl,tk + yum: name=perl,pciutils,gtk2,atk,cairo,gcc-gfortran,libxml2-python,tcsh,libnl,lsof,tcl,tk,kernel-devel,python-devel,createrepo sudo: true ignore_errors: true when: ansible_os_family == "RedHat" @@ -13,99 +13,29 @@ register: drivers_installed ignore_errors: true +- name: set install + set_fact: install_now=True, reboot_now=False + -# This is NASTY. Don't upgrade production systems without taking them out of the queue first. -#- name: yum update to upgrade kernel -# shell: "yum update -y" -# sudo: true -# ignore_errors: true -# when: ansible_os_family == "RedHat" and drivers_installed|failed - -# -# A REBOOT IS NEEDED AFTER a KERNEL UPDATE -# -#- name: restart machine -# shell: sleep 5; sudo shutdown -r now "Ansible updates triggered" -# async: 2 -# poll: 0 -# ignore_errors: true -# sudo: true -# when: ansible_os_family == "RedHat" and drivers_installed|failed -# -#- name: waiting for server to come back -# local_action: wait_for host={{ ansible_host }} state=started port=22 delay=10 search_regex=OpenSSH -# sudo: false -# -#- name: waiting for server to come back number 2 -# local_action: wait_for host={{ ansible_host }} state=started port=22 delay=10 search_regex=OpenSSH -# sudo: false - name: copy driver source #make this a variable - unarchive: copy=yes src="files/{{ MELLANOX_DRIVER_SRC }}.tgz" dest=/tmp + unarchive: copy=no src="http://consistency0/src/{{ MELLANOX_DRIVER_SRC }}.tgz" dest=/tmp sudo: true #when: drivers_installed|failed and ansible_os_family=="RedHat" and ansible_distribution_major_version == "7" - when: drivers_installed|failed + when: install_now - name: install drivers - shell: ./mlnxofedinstall -q + shell: ./mlnxofedinstall -q --add-kernel-support --force args: #more changes chdir: "/tmp/{{ MELLANOX_DRIVER_SRC }}" sudo: true - when: drivers_installed|failed + when: install_now -# -# get IP address before reboot -# -- name: get IP address - local_action: command ./scripts/map_ib_ip.pl {{ inventory_hostname }} - register: ip_address - sudo: false - #when: drivers_installed|failed - -#get the interface name -- name: get devide name of Mellanox Interface from ibdev2netdev.sh - script: ibdev2netdev.sh - register: MELLANOX_DEVICE_NAME - sudo: true -- name: create /etc/sysconfig/network-scripts/ifcfg-<device name> - template: dest=/etc/sysconfig/network-scripts/ifcfg-{{ MELLANOX_DEVICE_NAME.stdout }} src=ifcfg-conf.j2 owner=root group=root - sudo: true - when: ansible_os_family=="RedHat" - - -#ubuntu equivalent of previous command -- name: Ubuntu network interfaces - line 1 - lineinfile: - args: - dest: /etc/network/interfaces - line: auto {{ MELLANOX_DEVICE_NAME.stdout }} - state: present - sudo: true - when: ansible_os_family=="Debian" and drivers_installed|failed -- name: Ubuntu network interfaces - line 2 - lineinfile: - args: - dest: /etc/network/interfaces - line: iface {{ MELLANOX_DEVICE_NAME.stdout }} inet static - state: present - insertafter: "auto {{ MELLANOX_DEVICE_NAME.stdout }}" - sudo: true - when: ansible_os_family=="Debian" and drivers_installed|failed - -- name: Ubuntu network interfaces - line 3 - lineinfile: - args: - dest: /etc/network/interfaces - line: address {{ ip_address.stdout }} - state: present - insertafter: "iface {{ MELLANOX_DEVICE_NAME.stdout }} inet static" - sudo: true - when: ansible_os_family=="Debian" and drivers_installed|failed # # A REBOOT IS NEEDED AFTER SUCCESSFUL INSTALL # @@ -115,29 +45,9 @@ poll: 1 ignore_errors: true sudo: true - when: ansible_os_family=="RedHat" and drivers_installed|failed - -- name: restart machine for Ubuntu -cos it is 'special' - shell: "sleep 5; sudo shutdown -r now" - async: 2 - poll: 1 - ignore_errors: true - sudo: true - when: ansible_os_family=="Debian" and drivers_installed|failed + when: reboot_now - name: waiting for server to come back local_action: wait_for host={{ ansible_host }} state=started port=22 delay=10 search_regex=OpenSSH sudo: false - when: drivers_installed|failed - -- name: waiting for server to come back 2 - local_action: wait_for host={{ ansible_host }} state=started port=22 delay=10 search_regex=OpenSSH - when: drivers_installed|failed - -- name: bring up interface - #variable=eth0 or ens6 or eth1 - command: ifup {{ MELLANOX_DEVICE_NAME.stdout }} - sudo: true - when: ansible_os_family=="RedHat" and ansible_distribution_major_version == "7" - - + when: reboot_now -- GitLab