|
51 | 51 | return_content: yes
|
52 | 52 | register: check_virtual_media
|
53 | 53 |
|
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 |
68 | 55 | 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' |
69 | 81 |
|
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' |
82 | 89 |
|
83 | 90 | - name: DELL - Insert Virtual Media
|
84 | 91 | community.general.redfish_command:
|
|
0 commit comments