Skip to content
Snippets Groups Projects
Commit 2de17d14 authored by Simon Michnowicz's avatar Simon Michnowicz
Browse files

added conditionals to prevent installation if drivers already present (Note, tested only on redhat)

parent 17b43371
No related branches found
No related tags found
1 merge request!4added conditionals to prevent installation if drivers already present (Note, tested only on redhat)
...@@ -8,11 +8,17 @@ ...@@ -8,11 +8,17 @@
ignore_errors: true ignore_errors: true
when: ansible_os_family == "RedHat" when: ansible_os_family == "RedHat"
- name: test for existing installation of drivers
command: ibv_devinfo
sudo: true
register: drivers_installed
ignore_errors: true
- name: yum update to upgrade kernel - name: yum update to upgrade kernel
shell: "yum update -y" shell: "yum update -y"
sudo: true sudo: true
ignore_errors: true ignore_errors: true
when: ansible_os_family == "RedHat" when: ansible_os_family == "RedHat" and drivers_installed|failed
# #
# A REBOOT IS NEEDED AFTER a KERNEL UPDATE # A REBOOT IS NEEDED AFTER a KERNEL UPDATE
...@@ -23,10 +29,9 @@ ...@@ -23,10 +29,9 @@
poll: 0 poll: 0
ignore_errors: true ignore_errors: true
sudo: true sudo: true
when: ansible_os_family == "RedHat" when: ansible_os_family == "RedHat" and drivers_installed|failed
- 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_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 sudo: false
...@@ -34,11 +39,6 @@ ...@@ -34,11 +39,6 @@
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 sudo: false
- name: test for existing installation of drivers
command: ibv_devinfo
sudo: true
register: drivers_installed
ignore_errors: true
- name: copy driver source - name: copy driver source
#make this a variable #make this a variable
...@@ -62,12 +62,14 @@ ...@@ -62,12 +62,14 @@
local_action: command ./scripts/map_ib_ip.pl {{ inventory_hostname }} local_action: command ./scripts/map_ib_ip.pl {{ inventory_hostname }}
register: ip_address register: ip_address
sudo: false sudo: false
#when: drivers_installed|failed
- name: template IP address - name: template IP address
template: dest=/etc/sysconfig/network-scripts/ifcfg-ens6 src=ifcfg-ens6.j2 owner=root group=root template: dest=/etc/sysconfig/network-scripts/ifcfg-ens6 src=ifcfg-ens6.j2 owner=root group=root
sudo: true sudo: true
when: ansible_os_family=="RedHat" and ansible_distribution_major_version == "7" when: ansible_os_family=="RedHat" and ansible_distribution_major_version == "7" and drivers_installed|failed
#ubuntu equivalent of previous command #ubuntu equivalent of previous command
- name: Ubuntu network interfaces - line 1 - name: Ubuntu network interfaces - line 1
lineinfile: lineinfile:
...@@ -76,7 +78,8 @@ ...@@ -76,7 +78,8 @@
line: auto {{ MELLANOX_DEVICE_NAME }} line: auto {{ MELLANOX_DEVICE_NAME }}
state: present state: present
sudo: true sudo: true
when: ansible_os_family=="Debian" when: ansible_os_family=="Debian" and drivers_installed|failed
- name: Ubuntu network interfaces - line 2 - name: Ubuntu network interfaces - line 2
lineinfile: lineinfile:
args: args:
...@@ -85,7 +88,7 @@ ...@@ -85,7 +88,7 @@
state: present state: present
insertafter: "auto {{ MELLANOX_DEVICE_NAME }}" insertafter: "auto {{ MELLANOX_DEVICE_NAME }}"
sudo: true sudo: true
when: ansible_os_family=="Debian" when: ansible_os_family=="Debian" and drivers_installed|failed
- name: Ubuntu network interfaces - line 3 - name: Ubuntu network interfaces - line 3
lineinfile: lineinfile:
args: args:
...@@ -94,7 +97,7 @@ ...@@ -94,7 +97,7 @@
state: present state: present
insertafter: "iface {{ MELLANOX_DEVICE_NAME }} inet static" insertafter: "iface {{ MELLANOX_DEVICE_NAME }} inet static"
sudo: true sudo: true
when: ansible_os_family=="Debian" when: ansible_os_family=="Debian" and drivers_installed|failed
# #
# A REBOOT IS NEEDED AFTER SUCCESSFUL INSTALL # A REBOOT IS NEEDED AFTER SUCCESSFUL INSTALL
# #
...@@ -104,12 +107,12 @@ ...@@ -104,12 +107,12 @@
poll: 0 poll: 0
ignore_errors: true ignore_errors: true
sudo: true sudo: true
when: ansible_os_family=="Centos" when: ansible_os_family=="Centos" and drivers_installed|failed
- name: restart machine for Ubuntu -cos it is 'special' - name: restart machine for Ubuntu -cos it is 'special'
command: "sudo shutdown -r now" shell: "sleep 5; sudo shutdown -r now"
async: 2 async: 2
poll: 0 poll: 1
ignore_errors: true ignore_errors: true
sudo: true sudo: true
when: ansible_os_family=="Debian" when: ansible_os_family=="Debian"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment