Skip to content

Commit

Permalink
Add ansible playbooks for changing boot order.
Browse files Browse the repository at this point in the history
This patch also includes a fix for the notifications
as an environment is prepped.  Before the "go-live" time
is reached we need to look at the full summary of the
defined environments.

This patch also adds the username/pass for the foreman
views to be included in the notifications.

fixes: #18
resolves: https://trello.com/c/YIJB9muP/10-quads-reconfiguration-of-boot-sequence-when-reservation-expires

Change-Id: Iaf5055c153fb56a6fbff7e5fb19fea1377d8dc40
  • Loading branch information
kambiz-aghaiepour committed Feb 2, 2017
1 parent 32f3197 commit 902d800
Show file tree
Hide file tree
Showing 16 changed files with 2,058 additions and 12 deletions.
218 changes: 218 additions & 0 deletions ansible/racadm-setup-boot-r620-director.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,218 @@
---
- gather_facts: False
name: check for racadm
vars:
untouchables: mgmt-foreman.example.com
hosts: all:!{{untouchables}}
tasks:

# reset the drac
- name: racadm racreset
raw: racadm racreset hard -f
args:
executable: ''
register: result_racreset
- debug: var=result_racreset

# pause
- name: pause for reset
pause:
minutes: 3

# Delete the jobqueue so we can search it reliably later
- name: racadm jobqueue delete
raw: racadm jobqueue delete --all
args:
executable: ''
register: result_jobqueue
- debug: var=result_jobqueue

# use the hammer
- name: racadm JID_CLEARALL_FORCE
raw: racadm jobqueue delete -i JID_CLEARALL_FORCE
args:
executable: ''
register: result_clearall_force
- debug: var=result_clearall_force

# pause
- name: pause for reset
pause:
minutes: 1

# ensure 2nd interface can PXE
- name: racadm setup NIC1
raw: racadm set NIC.NICConfig.2.LegacyBootProto PXE
args:
executable: ''
register: result_nicconfig
- debug: var=result_nicconfig
#
# Commit the changes to the 1st NIC
- name: racadm NIC reconfig
raw: racadm jobqueue create NIC.Integrated.1-2-1 -r pwrcycle -s TIME_NOW
args:
executable: ''
register: result_pwrcycle
- debug: var=result_pwrcycle

# Now wait for the jobqueue to finish
- name: racadm check complete
raw: racadm jobqueue view
ignore_errors: yes
args:
executable: ''
register: result_check_complete
until: result_check_complete.stdout.find("Status=Completed") != -1 and result_check_complete.stdout.find("Status=Running") == -1
retries: 50
delay: 10
- debug: var=result_check_complete

# Delete the jobqueue so we can search it reliably later
- name: racadm jobqueue delete
raw: racadm jobqueue delete --all
args:
executable: ''
register: result_jobqueue
- debug: var=result_jobqueue

# use the hammer
- name: racadm JID_CLEARALL_FORCE
raw: racadm jobqueue delete -i JID_CLEARALL_FORCE
args:
executable: ''
register: result_clearall_force
- debug: var=result_clearall_force

# pause
- name: pause for reset
pause:
minutes: 1

# ensure 1st interface cant PXE
- name: racadm setup NIC2
raw: racadm set NIC.NICConfig.1.LegacyBootProto NONE
args:
executable: ''
register: result_nicconfig
- debug: var=result_nicconfig

# Commit the changes to the 2nd NIC
- name: racadm NIC reconfig
raw: racadm jobqueue create NIC.Integrated.1-1-1 -r pwrcycle -s TIME_NOW
args:
executable: ''
register: result_pwrcycle
- debug: var=result_pwrcycle

# Now wait for the jobqueue to finish
- name: racadm check complete
raw: racadm jobqueue view
ignore_errors: yes
args:
executable: ''
register: result_check_complete
until: result_check_complete.stdout.find("Status=Completed") != -1 and result_check_complete.stdout.find("Status=Running") == -1
retries: 50
delay: 10
- debug: var=result_check_complete

# Delete the jobqueue so we can search it reliably later
- name: racadm jobqueue delete
raw: racadm jobqueue delete --all
args:
executable: ''
register: result_jobqueue
- debug: var=result_jobqueue

# use the hammer
- name: racadm JID_CLEARALL_FORCE
raw: racadm jobqueue delete -i JID_CLEARALL_FORCE
args:
executable: ''
register: result_clearall_force
- debug: var=result_clearall_force

# pause
- name: pause for reset
pause:
minutes: 1

# ensure 3nd interface cant PXE
- name: racadm setup NIC3
raw: racadm set NIC.NICConfig.3.LegacyBootProto NONE
args:
executable: ''
register: result_nicconfig
- debug: var=result_nicconfig

# Commit the changes to the 3rd NIC
- name: racadm NIC reconfig
raw: racadm jobqueue create NIC.Integrated.1-3-1 -r pwrcycle -s TIME_NOW
args:
executable: ''
register: result_pwrcycle
- debug: var=result_pwrcycle

# Now wait for the jobqueue to finish
- name: racadm check complete
raw: racadm jobqueue view
ignore_errors: yes
args:
executable: ''
register: result_check_complete
until: result_check_complete.stdout.find("Status=Completed") != -1 and result_check_complete.stdout.find("Status=Running") == -1
retries: 50
delay: 10
- debug: var=result_check_complete

# Delete the jobqueue so we can search it reliably later
- name: racadm jobqueue delete
raw: racadm jobqueue delete --all
args:
executable: ''
register: result_jobqueue
- debug: var=result_jobqueue

# use the hammer
- name: racadm JID_CLEARALL_FORCE
raw: racadm jobqueue delete -i JID_CLEARALL_FORCE
args:
executable: ''
register: result_clearall_force
- debug: var=result_clearall_force

# pause
- name: pause for reset
pause:
minutes: 1

# 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
args:
executable: ''
register: result_boot_setup
- debug: var=result_boot_setup

# Commit the changes to the bios
- name: racadm bios reconfigure powercycle
raw: racadm jobqueue create BIOS.Setup.1-1 -r pwrcycle -s TIME_NOW
ignore_errors: yes
args:
executable: ''
register: result_pwrcycle
- debug: var=result_pwrcycle

# Now wait for the jobqueue to finish
- name: racadm check complete
raw: racadm jobqueue view
ignore_errors: yes
args:
executable: ''
register: result_check_complete
until: result_check_complete.stdout.find("Status=Completed") != -1 and result_check_complete.stdout.find("Status=Running") == -1
retries: 50
delay: 10
- debug: var=result_check_complete

Loading

0 comments on commit 902d800

Please sign in to comment.