Commit 24306823 authored by Simon Michnowicz's avatar Simon Michnowicz
Browse files

debugged previous version. This now works for ubuntu 14.14

added a var file. Unrolled some 'apt .deb' loops. Removed sleep before reboot
Fixed up network file creation for unbutu with inline commands
parent 94184cb2
--- ---
- include_vars: mellanoxVars.yml
- name: yum install dependencies - 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
sudo: true sudo: true
ignore_errors: true ignore_errors: true
when: ansible_os_family == "RedHat"
- name: yum update to upgrade kernel - name: yum update to upgrade kernel
shell: "yum update -y" shell: "yum update -y"
sudo: true sudo: true
when: ansible_os_family=="RedHat" and ansible_distribution_major_version == "7" ignore_errors: true
when: ansible_os_family == "RedHat"
# #
# A REBOOT IS NEEDED AFTER a KERNEL UPDATE # A REBOOT IS NEEDED AFTER a KERNEL UPDATE
...@@ -19,6 +23,7 @@ ...@@ -19,6 +23,7 @@
poll: 0 poll: 0
ignore_errors: true ignore_errors: true
sudo: true sudo: true
when: ansible_os_family == "RedHat"
- name: waiting for server to come back - name: waiting for server to come back
#local_action: wait_for host={{ ansible_host }} state=started port=22 delay=10 search_regex=OpenSSH #local_action: wait_for host={{ ansible_host }} state=started port=22 delay=10 search_regex=OpenSSH
...@@ -36,26 +41,78 @@ ...@@ -36,26 +41,78 @@
ignore_errors: true ignore_errors: true
- name: copy driver source - name: copy driver source
unarchive: copy=yes src=files/MLNX_OFED_LINUX-3.1-1.0.3-rhel7.1-x86_64-ext.tgz dest=/tmp #make this a variable
unarchive: copy=yes src="files/{{ MELLANOX_DRIVER_SRC }}.tgz" dest=/tmp
sudo: true sudo: true
when: drivers_installed|failed and ansible_os_family=="RedHat" and ansible_distribution_major_version == "7" #when: drivers_installed|failed and ansible_os_family=="RedHat" and ansible_distribution_major_version == "7"
when: drivers_installed|failed
- name: install drivers - name: install drivers
shell: ./mlnxofedinstall -q shell: ./mlnxofedinstall -q
args: args:
chdir: /tmp/MLNX_OFED_LINUX-3.1-1.0.3-rhel7.1-x86_64-ext #more changes
chdir: "/tmp/{{ MELLANOX_DRIVER_SRC }}"
sudo: true sudo: true
when: drivers_installed|failed and ansible_distribution_major_version == "7" when: drivers_installed|failed
# #
# get IP address before reboot
#
- name: get IP address
local_action: command ./scripts/map_ib_ip.pl {{ inventory_hostname }}
register: ip_address
sudo: false
- name: template IP address
template: dest=/etc/sysconfig/network-scripts/ifcfg-ens6 src=ifcfg-ens6.j2 owner=root group=root
sudo: true
when: ansible_os_family=="RedHat" and ansible_distribution_major_version == "7"
#ubuntu equivalent of previous command
- name: Ubuntu network interfaces - line 1
lineinfile:
args:
dest: /etc/network/interfaces
line: auto {{ MELLANOX_DEVICE_NAME }}
state: present
sudo: true
when: ansible_os_family=="Debian"
- name: Ubuntu network interfaces - line 2
lineinfile:
args:
dest: /etc/network/interfaces
line: iface {{ MELLANOX_DEVICE_NAME }} inet static
state: present
insertafter: "auto {{ MELLANOX_DEVICE_NAME }}"
sudo: true
when: ansible_os_family=="Debian"
- name: Ubuntu network interfaces - line 3
lineinfile:
args:
dest: /etc/network/interfaces
line: address {{ ip_address.stdout }}
state: present
insertafter: "iface {{ MELLANOX_DEVICE_NAME }} inet static"
sudo: true
when: ansible_os_family=="Debian"
#
# A REBOOT IS NEEDED AFTER SUCCESSFUL INSTALL # A REBOOT IS NEEDED AFTER SUCCESSFUL INSTALL
# #
- name: restart machine - name: restart machine
command: sleep 5; sudo shutdown -r now "Ansible updates triggered" command: "sleep 5; sudo shutdown -r now"
async: 2 async: 2
poll: 0 poll: 0
ignore_errors: true ignore_errors: true
sudo: true sudo: true
when: ansible_os_family=="Centos"
- name: restart machine for Ubuntu -cos it is 'special'
command: "sudo shutdown -r now"
async: 2
poll: 0
ignore_errors: true
sudo: true
when: ansible_os_family=="Debian"
- name: waiting for server to come back - name: waiting for server to come back
local_action: wait_for host={{ ansible_ssh_host }} state=started port=22 delay=10 search_regex=OpenSSH local_action: wait_for host={{ ansible_ssh_host }} state=started port=22 delay=10 search_regex=OpenSSH
...@@ -63,23 +120,11 @@ ...@@ -63,23 +120,11 @@
- name: waiting for server to come back 2 - name: waiting for server to come back 2
local_action: wait_for host={{ ansible_ssh_host }} state=started port=22 delay=10 search_regex=OpenSSH local_action: wait_for host={{ ansible_ssh_host }} state=started port=22 delay=10 search_regex=OpenSSH
sudo: false
- name: get IP address
local_action: command ./scripts/map_ib_ip.pl {{ inventory_hostname }}
register: ip_address
- name: template IP address
template: dest=/etc/sysconfig/network-scripts/ifcfg-ens6 src=ifcfg-ens6.j2 owner=root group=root
sudo: true
when: ansible_distribution_major_version == "7"
- name: bring up interface - name: bring up interface
command: ifup ens6 #variable=eth0 or ens6
command: ifup {{ MELLANOX_DEVICE_NAME }}
sudo: true sudo: true
when: ansible_distribution_major_version == "7" when: ansible_distribution_major_version == "7"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment