Skip to content

Commit 23b93e0

Browse files
committed
Address stuck virtual media
1 parent 767dd03 commit 23b93e0

File tree

1 file changed

+33
-26
lines changed

1 file changed

+33
-26
lines changed

ansible/roles/boot-iso/tasks/dell.yml

Lines changed: 33 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -51,34 +51,41 @@
5151
return_content: yes
5252
register: check_virtual_media
5353

54-
- name: Dell - Eject any CD Virtual Media
55-
uri:
56-
url: "https://{{ hostvars[item]['bmc_address'] }}/redfish/v1/Managers/iDRAC.Embedded.1/VirtualMedia/CD/Actions/VirtualMedia.EjectMedia"
57-
user: "{{ hostvars[item]['bmc_user'] }}"
58-
password: "{{ hostvars[item]['bmc_password'] }}"
59-
method: POST
60-
headers:
61-
content-type: application/json
62-
Accept: application/json
63-
body: {}
64-
body_format: json
65-
validate_certs: no
66-
status_code: 204
67-
return_content: yes
54+
- name: Block to rescue incase of stuck virtual media
6855
when: check_virtual_media.json.Image
56+
block:
57+
- name: Dell - Eject any CD Virtual Media
58+
uri:
59+
url: "https://{{ hostvars[item]['bmc_address'] }}/redfish/v1/Managers/iDRAC.Embedded.1/VirtualMedia/CD/Actions/VirtualMedia.EjectMedia"
60+
user: "{{ hostvars[item]['bmc_user'] }}"
61+
password: "{{ hostvars[item]['bmc_password'] }}"
62+
method: POST
63+
headers:
64+
content-type: application/json
65+
Accept: application/json
66+
body: {}
67+
body_format: json
68+
validate_certs: no
69+
status_code: 204
70+
return_content: yes
71+
72+
rescue:
73+
# Use racadm to address the failed redfish unmount of old virtual media
74+
- name: Force mount of a existing image
75+
raw: racadm remoteimage -c -u "" -p "" -l http://{{ http_store_host }}:{{ http_store_port }}/{{ _virtual_media_iso }}
76+
delegate_to: "{{ hostvars[item]['bmc_address'] }}"
77+
vars:
78+
ansible_user: "{{ hostvars[item]['bmc_user'] }}"
79+
ansible_password: "{{ hostvars[item]['bmc_password'] }}"
80+
ansible_ssh_common_args: '-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null'
6981

70-
# # Eject just the found image
71-
# - name: DELL - Eject Virtual Media
72-
# community.general.redfish_command:
73-
# category: Manager
74-
# command: VirtualMediaEject
75-
# baseuri: "{{ hostvars[item]['bmc_address'] }}"
76-
# username: "{{ hostvars[item]['bmc_user'] }}"
77-
# password: "{{ hostvars[item]['bmc_password'] }}"
78-
# virtual_media:
79-
# image_url: "{{ check_virtual_media.json.Image }}"
80-
# resource_id: iDRAC.Embedded.1
81-
# ignore_errors: yes
82+
- name: Force unmount of the existing image
83+
raw: racadm remoteimage -d
84+
delegate_to: "{{ hostvars[item]['bmc_address'] }}"
85+
vars:
86+
ansible_user: "{{ hostvars[item]['bmc_user'] }}"
87+
ansible_password: "{{ hostvars[item]['bmc_password'] }}"
88+
ansible_ssh_common_args: '-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null'
8289

8390
- name: DELL - Insert Virtual Media
8491
community.general.redfish_command:

0 commit comments

Comments
 (0)