Skip to content

Commit

Permalink
Add interface confirmation checks with racadm
Browse files Browse the repository at this point in the history
This adds a task to check iDRAC via racadm and retrieve
and compare the string returned from BIOS.BiosBootSettings.BootSeq
so we're sure what the playbook sets (and succeeds) actually
reflects the current system interface order.

Fixes: #174

Change-Id: I2295d7b44ac43e59fc0786a0c28786e02d0a91c2
  • Loading branch information
sadsfae committed Apr 17, 2018
1 parent 4cb2608 commit 4ba5e02
Show file tree
Hide file tree
Showing 9 changed files with 138 additions and 17 deletions.
16 changes: 16 additions & 0 deletions ansible/idrac_interfaces.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---

# We will store store Dell racadm interface description
# to server type mappings here
#
#
director_r620_interfaces: NIC.Slot.2-4,HardDisk.List.1-1,NIC.Slot.2-1,NIC.Slot.2-2,NIC.Slot.2-3,NIC.Integrated.1-3-1
director_r630_interfaces: NIC.Integrated.1-2-1,HardDisk.List.1-1,NIC.Slot.2-1-1
director_r720xd_interfaces: NIC.Slot.4-2-1,HardDisk.List.1-1,NIC.Integrated.1-3-1
director_r730xd_interfaces: NIC.Integrated.1-2-1,HardDisk.List.1-1,NIC.Integrated.1-3-1
director_r930_interfaces: NIC.Integrated.1-2-1,HardDisk.List.1-1,NIC.Integrated.1-3-1
foreman_r620_interfaces: NIC.Integrated.1-3-1,HardDisk.List.1-1,NIC.Slot.2-4,NIC.Slot.2-1,NIC.Slot.2-2,NIC.Slot.2-3
foreman_r630_interfaces: NIC.Slot.2-1-1,HardDisk.List.1-1,NIC.Integrated.1-2-1
foreman_r720xd_interfaces: NIC.Integrated.1-3-1,HardDisk.List.1-1,NIC.Slot.4-2-1
foreman_r730xd_interfaces: NIC.Integrated.1-3-1,HardDisk.List.1-1,NIC.Integrated.1-2-1
foreman_r930_interfaces: NIC.Integrated.1-3-1,HardDisk.List.1-1,NIC.Integrated.1-2-1
17 changes: 15 additions & 2 deletions ansible/racadm-setup-boot-r630-director.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
vars:
untouchables: mgmt-foreman.example.com
hosts: all:!{{untouchables}}
tasks:
vars_files:
- idrac_interfaces.yml
tasks:

# try to gracefully shutdown target server
- name: shutdown underlying OS
Expand Down Expand Up @@ -66,7 +68,7 @@

# setup the new boot order to ensure 1st nic is before disk
- name: racadm setup boot
raw: racadm set BIOS.BiosBootSettings.BootSeq NIC.Integrated.1-2-1,HardDisk.List.1-1,NIC.Slot.2-1-1
raw: racadm set BIOS.BiosBootSettings.BootSeq {{director_r630_interfaces}}
args:
executable: ''
register: result_boot_setup
Expand Down Expand Up @@ -102,6 +104,17 @@
delay: 10
- debug: var=result_check_complete

# Test that our settings actually took
- name: retrieve the actual boot settings via racadm
raw: racadm get BIOS.BiosBootSettings.BootSeq
args:
executable: ''
register: racadm_boot_results
until: racadm_boot_results.stdout.find("BootSeq={{director_r630_interfaces}}") != -1
retries: 50
delay: 10
- debug: var=racadm_boot_results

# Record when we are finished
- name: Generate Time of Completion
local_action: command date +%Y-%m-%d-%H:%M
Expand Down
17 changes: 15 additions & 2 deletions ansible/racadm-setup-boot-r630-foreman.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
vars:
untouchables: mgmt-foreman.example.com
hosts: all:!{{untouchables}}
tasks:
vars_files:
- idrac_interfaces.yml
tasks:

# try to gracefully shutdown target server
- name: shutdown underlying OS
Expand Down Expand Up @@ -66,7 +68,7 @@

# setup the new boot order to ensure 1st nic is before disk
- name: racadm setup boot
raw: racadm set BIOS.BiosBootSettings.BootSeq NIC.Slot.2-1-1,HardDisk.List.1-1,NIC.Integrated.1-2-1
raw: racadm set BIOS.BiosBootSettings.BootSeq {{foreman_r630_interfaces}}
args:
executable: ''
register: result_boot_setup
Expand Down Expand Up @@ -102,6 +104,17 @@
delay: 10
- debug: var=result_check_complete

# Test that our settings actually took
- name: retrieve the actual boot settings via racadm
raw: racadm get BIOS.BiosBootSettings.BootSeq
args:
executable: ''
register: racadm_boot_results
until: racadm_boot_results.stdout.find("BootSeq={{foreman_r630_interfaces}}") != -1
retries: 50
delay: 10
- debug: var=racadm_boot_results

# Record when we are finished
- name: Generate Time of Completion
local_action: command date +%Y-%m-%d-%H:%M
Expand Down
17 changes: 15 additions & 2 deletions ansible/racadm-setup-boot-r720xd-director.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
name: check for racadm
vars:
untouchables: mgmt-foreman.example.com
hosts: all:!{{untouchables}}
vars_files:
- idrac_interfaces.yml
hosts: all:!{{untouchables}}
tasks:

# try to gracefully shutdown target server
Expand Down Expand Up @@ -62,7 +64,7 @@

# setup the new boot order to ensure 1st nic is before disk
- name: racadm setup boot
raw: racadm set BIOS.BiosBootSettings.BootSeq NIC.Slot.4-2-1,HardDisk.List.1-1,NIC.Integrated.1-3-1
raw: racadm set BIOS.BiosBootSettings.BootSeq {{director_r720xd_interfaces}}
args:
executable: ''
register: result_boot_setup
Expand Down Expand Up @@ -98,6 +100,17 @@
delay: 10
- debug: var=result_check_complete

# Test that our settings actually took
- name: retrieve the actual boot settings via racadm
raw: racadm get BIOS.BiosBootSettings.BootSeq
args:
executable: ''
register: racadm_boot_results
until: racadm_boot_results.stdout.find("BootSeq={{director_r720xd_interfaces}}") != -1
retries: 50
delay: 10
- debug: var=racadm_boot_results

# Record when we are finished
- name: Generate Time of Completion
local_action: command date +%Y-%m-%d-%H:%M
Expand Down
17 changes: 15 additions & 2 deletions ansible/racadm-setup-boot-r720xd-foreman.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
vars:
untouchables: mgmt-foreman.example.com
hosts: all:!{{untouchables}}
tasks:
vars_files:
- idrac_interfaces.yml
tasks:

# try to gracefully shutdown target server
- name: shutdown underlying OS
Expand Down Expand Up @@ -62,7 +64,7 @@

# setup the new boot order to ensure 1st nic is before disk
- name: racadm setup boot
raw: racadm set BIOS.BiosBootSettings.BootSeq NIC.Integrated.1-3-1,HardDisk.List.1-1,NIC.Slot.4-2-1
raw: racadm set BIOS.BiosBootSettings.BootSeq {{foreman_r720xd_interfaces}}
args:
executable: ''
register: result_boot_setup
Expand Down Expand Up @@ -98,6 +100,17 @@
delay: 10
- debug: var=result_check_complete

# Test that our settings actually took
- name: retrieve the actual boot settings via racadm
raw: racadm get BIOS.BiosBootSettings.BootSeq
args:
executable: ''
register: racadm_boot_results
until: racadm_boot_results.stdout.find("BootSeq={{foreman_r720xd_interfaces}}") != -1
retries: 50
delay: 10
- debug: var=racadm_boot_results

# Record when we are finished
- name: Generate Time of Completion
local_action: command date +%Y-%m-%d-%H:%M
Expand Down
17 changes: 15 additions & 2 deletions ansible/racadm-setup-boot-r730xd-director.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
vars:
untouchables: mgmt-foreman.example.com
hosts: all:!{{untouchables}}
tasks:
vars_files:
- idrac_interfaces.yml
tasks:

# try to gracefully shutdown target server
- name: shutdown underlying OS
Expand Down Expand Up @@ -66,7 +68,7 @@

# setup the new boot order to ensure 1st nic is before disk
- name: racadm setup boot
raw: racadm set BIOS.BiosBootSettings.BootSeq NIC.Integrated.1-2-1,HardDisk.List.1-1,NIC.Integrated.1-3-1
raw: racadm set BIOS.BiosBootSettings.BootSeq {{director_r730xd_interfaces}}
args:
executable: ''
register: result_boot_setup
Expand Down Expand Up @@ -102,6 +104,17 @@
delay: 10
- debug: var=result_check_complete

# Test that our settings actually took
- name: retrieve the actual boot settings via racadm
raw: racadm get BIOS.BiosBootSettings.BootSeq
args:
executable: ''
register: racadm_boot_results
until: racadm_boot_results.stdout.find("BootSeq={{director_r730xd_interfaces}}") != -1
retries: 50
delay: 10
- debug: var=racadm_boot_results

# Record when we are finished
- name: Generate Time of Completion
local_action: command date +%Y-%m-%d-%H:%M
Expand Down
19 changes: 17 additions & 2 deletions ansible/racadm-setup-boot-r730xd-foreman.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
vars:
untouchables: mgmt-foreman.example.com
hosts: all:!{{untouchables}}
tasks:
vars_files:
- idrac_interfaces.yml
tasks:

# try to gracefully shutdown target server
- name: shutdown underlying OS
Expand Down Expand Up @@ -66,7 +68,7 @@

# setup the new boot order to ensure 1st nic is before disk
- name: racadm setup boot
raw: racadm set BIOS.BiosBootSettings.BootSeq NIC.Integrated.1-3-1,HardDisk.List.1-1,NIC.Integrated.1-2-1
raw: racadm set BIOS.BiosBootSettings.BootSeq {{foreman_r730dx_interfaces}}
args:
executable: ''
register: result_boot_setup
Expand Down Expand Up @@ -102,6 +104,19 @@
delay: 10
- debug: var=result_check_complete

# Test that our settings actually took
- name: retrieve the actual boot settings via racadm
raw: racadm get BIOS.BiosBootSettings.BootSeq
args:
executable: ''
register: racadm_boot_results
until: racadm_boot_results.stdout.find("BootSeq={{foreman_r730xd_interfaces}}") != -1
retries: 50
delay: 10
- debug: var=racadm_boot_results



# Record when we are finished
- name: Generate Time of Completion
local_action: command date +%Y-%m-%d-%H:%M
Expand Down
17 changes: 15 additions & 2 deletions ansible/racadm-setup-boot-r930-director.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
vars:
untouchables: mgmt-foreman.example.com
hosts: all:!{{untouchables}}
tasks:
vars_files:
- idrac_interfaces.yml
tasks:

# try to gracefully shutdown target server
- name: shutdown underlying OS
Expand Down Expand Up @@ -66,7 +68,7 @@

# setup the new boot order to ensure 1st nic is before disk
- name: racadm setup boot
raw: racadm set BIOS.BiosBootSettings.BootSeq NIC.Integrated.1-2-1,HardDisk.List.1-1,NIC.Integrated.1-3-1
raw: racadm set BIOS.BiosBootSettings.BootSeq {{director_r930_interfaces}}
args:
executable: ''
register: result_boot_setup
Expand Down Expand Up @@ -102,6 +104,17 @@
delay: 10
- debug: var=result_check_complete

# Test that our settings actually took
- name: retrieve the actual boot settings via racadm
raw: racadm get BIOS.BiosBootSettings.BootSeq
args:
executable: ''
register: racadm_boot_results
until: racadm_boot_results.stdout.find("BootSeq={{director_r930_interfaces}}") != -1
retries: 50
delay: 10
- debug: var=racadm_boot_results

# Record when we are finished
- name: Generate Time of Completion
local_action: command date +%Y-%m-%d-%H:%M
Expand Down
18 changes: 15 additions & 3 deletions ansible/racadm-setup-boot-r930-foreman.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---

# R620 hosts
# foreman: NIC.Integrated.1-3-1,HardDisk.List.1-1,NIC.Slot.2-4,NIC.Slot.2-1,NIC.Slot.2-2,NIC.Slot.2-3
# director: NIC.Slot.2-4,HardDisk.List.1-1,NIC.Slot.2-1,NIC.Slot.2-2,NIC.Slot.2-3,NIC.Integrated.1-3-1
Expand All @@ -23,7 +22,9 @@
vars:
untouchables: mgmt-foreman.example.com
hosts: all:!{{untouchables}}
tasks:
vars_files:
- idrac_interfaces.yml
tasks:

# try to gracefully shutdown target server
- name: shutdown underlying OS
Expand Down Expand Up @@ -66,7 +67,7 @@

# setup the new boot order to ensure 1st nic is before disk
- name: racadm setup boot
raw: racadm set BIOS.BiosBootSettings.BootSeq NIC.Integrated.1-3-1,HardDisk.List.1-1,NIC.Integrated.1-2-1
raw: racadm set BIOS.BiosBootSettings.BootSeq {{foreman_r930_interfaces}}
args:
executable: ''
register: result_boot_setup
Expand Down Expand Up @@ -102,6 +103,17 @@
delay: 10
- debug: var=result_check_complete

# Test that our settings actually took
- name: retrieve the actual boot settings via racadm
raw: racadm get BIOS.BiosBootSettings.BootSeq
args:
executable: ''
register: racadm_boot_results
until: racadm_boot_results.stdout.find("BootSeq={{foreman_r930_interfaces}}") != -1
retries: 50
delay: 10
- debug: var=racadm_boot_results

# Record when we are finished
- name: Generate Time of Completion
local_action: command date +%Y-%m-%d-%H:%M
Expand Down

0 comments on commit 4ba5e02

Please sign in to comment.