Init: mediaserver

This commit is contained in:
2023-02-08 12:13:28 +01:00
parent 848bc9739c
commit f7c23d4ba9
31914 changed files with 6175775 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
---
- hosts: redfish_hosts
connection: local
gather_facts: false
name: "Ansible Module for Simple Firmware Update"
collections:
- dellemc.openmanage
tasks:
- name: "Update the firmware from a single executable file available in a local path"
redfish_firmware:
baseuri: "{{ baseuri }}"
username: "{{ username }}"
password: "{{ password }}"
ca_path: "/path/to/ca_cert.pem"
image_uri: "/home/firmware_repo/component.exe"
tags:
- local-update
- name: "Update the firmware from a single executable file available in a HTTP protocol"
redfish_firmware:
baseuri: "{{ baseuri }}"
username: "{{ username }}"
password: "{{ password }}"
ca_path: "/path/to/ca_cert.pem"
image_uri: "http://192.168.0.1/firmware_repo/component.exe"
tags:
- http-update

View File

@@ -0,0 +1,92 @@
---
- hosts: redfish_hosts
connection: local
gather_facts: false
name: "Ansible Module for Simple Firmware Update"
vars:
retries_count: 100
polling_interval: 5
reboot_uri: "/redfish/v1/Systems/System.Embedded.1/Actions/ComputerSystem.Reset"
collections:
- dellemc.openmanage
tasks:
- name: "Update the firmware from a single executable file available in a HTTP protocol"
redfish_firmware:
baseuri: "{{ baseuri }}"
username: "{{ username }}"
password: "{{ password }}"
ca_path: "/path/to/ca_cert.pem"
image_uri: "http://192.168.0.1/firmware_repo/component.exe"
register: result
- name: "Update the firmware from a single executable with job tracking till completion"
uri:
url: "https://{{ baseuri }}{{ result.task.uri }}"
user: "{{ username }}"
password: "{{ password }}"
method: "GET"
use_proxy: yes
status_code: 200, 202
return_content: yes
validate_certs: no
force_basic_auth: yes
headers:
Content-Type: "application/json"
Accept: "application/json"
register: job_result
until: job_result.json.TaskState == 'Completed' or job_result.json.TaskState == 'Pending'
retries: "{{ retries_count }}"
delay: "{{ polling_interval }}"
- name: "Update the firmware from a single executable reboot."
uri:
url: "https://{{ baseuri }}{{ reboot_uri }}"
user: "{{ username }}"
password: "{{ password }}"
method: "POST"
body_format: raw
body: '{"ResetType": "ForceRestart"}'
use_proxy: yes
status_code: 204
return_content: no
validate_certs: no
force_basic_auth: yes
headers:
Content-Type: "application/json"
Accept: "application/json"
register: reboot_result
changed_when: reboot_result.status == 204
when: job_result.json.TaskState == 'Pending' and job_result.json.Messages.0.Message == 'Task successfully scheduled.'
- name: "Update the firmware from a single executable Waits for 4 minutes."
wait_for:
timeout: 240
when: job_result.json.TaskState == 'Pending' and job_result.json.Messages.0.Message == 'Task successfully scheduled.'
- name: "Update the firmware from a single executable with job tracking till completion."
uri:
url: "https://{{ baseuri }}{{ result.task.uri }}"
user: "{{ username }}"
password: "{{ password }}"
method: "GET"
use_proxy: yes
status_code: 200, 202
return_content: yes
validate_certs: no
force_basic_auth: yes
headers:
Content-Type: "application/json"
Accept: "application/json"
register: final_result
until: final_result.json.TaskState == 'Completed'
retries: "{{ retries_count }}"
delay: "{{ polling_interval }}"
- name: "Update the firmware from a single executable fact."
set_fact:
job_details: "{{ final_result.json }}"
failed_when: final_result.json.TaskState == "Completed" and final_result.json.TaskStatus != "OK"
changed_when: final_result.json.TaskState == "Completed" and final_result.json.TaskStatus == "OK"

View File

@@ -0,0 +1,92 @@
---
- hosts: redfish_hosts
connection: local
gather_facts: false
name: "Ansible Module for Simple Firmware Update"
vars:
retries_count: 100
polling_interval: 5
reboot_uri: "/redfish/v1/Systems/System.Embedded.1/Actions/ComputerSystem.Reset"
collections:
- dellemc.openmanage
tasks:
- name: "Update the firmware from a single executable file available in a local path"
redfish_firmware:
baseuri: "{{ baseuri }}"
username: "{{ username }}"
password: "{{ password }}"
ca_path: "/path/to/ca_cert.pem"
image_uri: "/home/firmware_repo/component.exe"
register: result
- name: "Update the firmware from a single executable with job tracking till completion."
uri:
url: "https://{{ baseuri }}{{ result.task.uri }}"
user: "{{ username }}"
password: "{{ password }}"
method: "GET"
use_proxy: yes
status_code: 200, 202
return_content: yes
validate_certs: no
force_basic_auth: yes
headers:
Content-Type: "application/json"
Accept: "application/json"
register: job_result
until: job_result.json.TaskState == 'Completed' or job_result.json.TaskState == 'Pending'
retries: "{{ retries_count }}"
delay: "{{ polling_interval }}"
- name: "Update the firmware from a single executable reboot."
uri:
url: "https://{{ baseuri }}{{ reboot_uri }}"
user: "{{ username }}"
password: "{{ password }}"
method: "POST"
body_format: raw
body: '{"ResetType": "ForceRestart"}'
use_proxy: yes
status_code: 204
return_content: no
validate_certs: no
force_basic_auth: yes
headers:
Content-Type: "application/json"
Accept: "application/json"
register: reboot_result
changed_when: reboot_result.status == 204
when: job_result.json.TaskState == 'Pending' and job_result.json.Messages.0.Message == 'Task successfully scheduled.'
- name: "Update the firmware from a single executable Waits for 4 minutes."
wait_for:
timeout: 240
when: job_result.json.TaskState == 'Pending' and job_result.json.Messages.0.Message == 'Task successfully scheduled.'
- name: "Update the firmware from a single executable with job tracking till completion."
uri:
url: "https://{{ baseuri }}{{ result.task.uri }}"
user: "{{ username }}"
password: "{{ password }}"
method: "GET"
use_proxy: yes
status_code: 200, 202
return_content: yes
validate_certs: no
force_basic_auth: yes
headers:
Content-Type: "application/json"
Accept: "application/json"
register: final_result
until: final_result.json.TaskState == 'Completed'
retries: "{{ retries_count }}"
delay: "{{ polling_interval }}"
- name: "Update the firmware from a single executable fact."
set_fact:
job_details: "{{ final_result.json }}"
failed_when: final_result.json.TaskState == "Completed" and final_result.json.TaskStatus != "OK"
changed_when: final_result.json.TaskState == "Completed" and final_result.json.TaskStatus == "OK"

View File

@@ -0,0 +1,46 @@
---
- hosts: redfish
connection: local
name: Configure Redfish subscriptions
gather_facts: False
collections:
- dellemc.openmanage
tasks:
- name: Add Redfish metric subscription
redfish_event_subscription:
baseuri: "{{ baseuri }}"
username: "{{ username }}"
password: "{{ password }}"
ca_path: "/path/to/ca_cert.pem"
destination: "https://192.168.1.100:8188"
event_type: MetricReport
event_format_type: MetricReport
state: present
tags: add_metric_subscription
- name: Add Redfish alert subscription
redfish_event_subscription:
baseuri: "{{ baseuri }}"
username: "{{ username }}"
password: "{{ password }}"
ca_path: "/path/to/ca_cert.pem"
destination: "https://server01.example.com:8188"
event_type: Alert
event_format_type: Event
state: present
tags: add_alert_subscription
- name: Delete Redfish subscription with a specified destination
redfish_event_subscription:
baseuri: "{{ baseuri }}"
username: "{{ username }}"
password: "{{ password }}"
ca_path: "/path/to/ca_cert.pem"
destination: "https://server01.example.com:8188"
state: absent
tags: delete_subscription

View File

@@ -0,0 +1,26 @@
---
- hosts: redfish
connection: local
name: Configure Server Power Setting
gather_facts: False
collections:
- dellemc.openmanage
tasks:
- name: Manage power state of the first device.
redfish_powerstate:
baseuri: "{{ baseuri }}"
username: "{{ username }}"
password: "{{ password }}"
ca_path: "/path/to/ca_cert.pem"
reset_type: "On"
- name: Manage power state of a specified device.
redfish_powerstate:
baseuri: "{{ baseuri }}"
username: "{{ username }}"
password: "{{ password }}"
ca_path: "/path/to/ca_cert.pem"
reset_type: "ForceOff"
resource_id: "System.Embedded.1"

View File

@@ -0,0 +1,85 @@
---
- hosts: redfish_hosts
connection: local
gather_facts: false
name: "Redfish Storage Volume - Ansible Module"
vars:
retries_count: 15
polling_interval: 5
collections:
- dellemc.openmanage
tasks:
- name: Create a volume with supported options.
redfish_storage_volume:
baseuri: "{{ baseuri }}"
username: "{{ username }}"
password: "{{ password }}"
ca_path: "/path/to/ca_cert.pem"
state: "present"
volume_type: "Mirrored"
name: "VD0"
controller_id: "RAID.Slot.1-1"
drives:
- Disk.Bay.5:Enclosure.Internal.0-1:RAID.Slot.1-1
- Disk.Bay.6:Enclosure.Internal.0-1:RAID.Slot.1-1
block_size_bytes: 512
capacity_bytes: 299439751168
optimum_io_size_bytes: 65536
encryption_types: NativeDriveEncryption
encrypted: true
register: result
tags:
- create_volume1
- name: Create a volume with minimum options.
redfish_storage_volume:
baseuri: "{{ baseuri }}"
username: "{{ username }}"
password: "{{ password }}"
ca_path: "/path/to/ca_cert.pem"
state: "present"
controller_id: "RAID.Slot.1-1"
volume_type: "NonRedundant"
drives:
- Disk.Bay.1:Enclosure.Internal.0-1:RAID.Slot.1-1
tags:
- create_volume2
- name: Modify a volume's encryption type settings.
redfish_storage_volume:
baseuri: "{{ baseuri }}"
username: "{{ username }}"
password: "{{ password }}"
ca_path: "/path/to/ca_cert.pem"
state: "present"
volume_id: "Disk.Virtual.5:RAID.Slot.1-1"
encryption_types: "ControllerAssisted"
encrypted: true
tags:
- modify_volume
- name: Initialize an existing volume.
redfish_storage_volume:
baseuri: "{{ baseuri }}"
username: "{{ username }}"
password: "{{ password }}"
ca_path: "/path/to/ca_cert.pem"
command: "initialize"
volume_id: "Disk.Virtual.5:RAID.Slot.1-1"
initialize_type: "Slow"
tags:
- initialize_volume
- name: Delete an existing volume.
redfish_storage_volume:
baseuri: "{{ baseuri }}"
username: "{{ username }}"
password: "{{ password }}"
ca_path: "/path/to/ca_cert.pem"
state: "absent"
volume_id: "Disk.Virtual.5:RAID.Slot.1-1"
tags:
- delete_volume

View File

@@ -0,0 +1,93 @@
---
- hosts: redfish_hosts
connection: local
gather_facts: false
name: "Redfish Storage Volume - Ansible Module"
vars:
retries_count: 100
polling_interval: 10
reboot_uri: "/redfish/v1/Systems/System.Embedded.1/Actions/ComputerSystem.Reset"
collections:
- dellemc.openmanage
tasks:
- name: "Create a storage volume"
redfish_storage_volume:
baseuri: "{{ baseuri }}"
username: "{{ username }}"
password: "{{ password }}"
ca_path: "/path/to/ca_cert.pem"
state: "present"
name: "VD_BOSS"
controller_id: "AHCI.Slot.6-1"
drives:
- Disk.Direct.1-1:AHCI.Slot.6-1
- Disk.Direct.0-0:AHCI.Slot.6-1
optimum_io_size_bytes: 65536
volume_type: Mirrored
register: result
tags:
- create_volume
- name: "View the job details to track the status of the create storage volume task"
uri:
url: "https://{{ baseuri }}{{ result.task.uri }}"
user: "{{ username }}"
password: "{{ password }}"
method: "GET"
use_proxy: yes
status_code: 200, 202
return_content: yes
validate_certs: no
force_basic_auth: yes
headers:
Content-Type: "application/json"
Accept: "application/json"
register: job_result
failed_when: "'json' not in job_result"
until: job_result.json.TaskState == 'Completed' or job_result.json.TaskState == 'Pending'
retries: "{{ retries_count }}"
delay: "{{ polling_interval }}"
tags:
- job-tracking
- name: "Reboot the system if the job status is pending."
uri:
url: "https://{{ baseuri }}{{ reboot_uri }}"
user: "{{ username }}"
password: "{{ password }}"
method: "POST"
body_format: raw
body: '{"ResetType": "ForceRestart"}'
use_proxy: yes
status_code: 204
return_content: no
validate_certs: no
force_basic_auth: yes
headers:
Content-Type: "application/json"
Accept: "application/json"
register: reboot_result
changed_when: reboot_result.status == 204
when: job_result.json.TaskState == 'Pending' and job_result.json.Messages.0.Message == 'Task successfully scheduled.'
- name: "View the job details to verify if the task status is completed."
uri:
url: "https://{{ baseuri }}{{ result.task.uri }}"
user: "{{ username }}"
password: "{{ password }}"
method: "GET"
use_proxy: yes
status_code: 200, 202
return_content: yes
validate_certs: no
force_basic_auth: yes
headers:
Content-Type: "application/json"
Accept: "application/json"
register: final_result
failed_when: final_result.json.TaskState == "Completed" and final_result.json.TaskStatus != "OK"
until: final_result.json.TaskState == 'Completed'
retries: "{{ retries_count }}"
delay: "{{ polling_interval }}"

View File

@@ -0,0 +1,87 @@
---
- hosts: redfish_hosts
connection: local
gather_facts: false
name: "Redfish Storage Volume - Ansible Module"
vars:
retries_count: 100
polling_interval: 10
reboot_uri: "/redfish/v1/Systems/System.Embedded.1/Actions/ComputerSystem.Reset"
collections:
- dellemc.openmanage
tasks:
- name: "Delete an existing volume."
redfish_storage_volume:
baseuri: "{{ baseuri }}"
username: "{{ username }}"
password: "{{ password }}"
ca_path: "/path/to/ca_cert.pem"
state: "absent"
volume_id: "Disk.Virtual.1:RAID.Slot.1-1"
register: result
tags:
- delete_volume
- name: "View the job details to track the status of the delete storage volume task"
uri:
url: "https://{{ baseuri }}{{ result.task.uri }}"
user: "{{ username }}"
password: "{{ password }}"
method: "GET"
use_proxy: yes
status_code: 200, 202
return_content: yes
validate_certs: no
force_basic_auth: yes
headers:
Content-Type: "application/json"
Accept: "application/json"
register: job_result
failed_when: "'json' not in job_result"
until: job_result.json.TaskState == 'Completed' or job_result.json.TaskState == 'Pending'
retries: "{{ retries_count }}"
delay: "{{ polling_interval }}"
tags:
- job-tracking
- name: "Reboot the system if the job status is pending."
uri:
url: "https://{{ baseuri }}{{ reboot_uri }}"
user: "{{ username }}"
password: "{{ password }}"
method: "POST"
body_format: raw
body: '{"ResetType": "ForceRestart"}'
use_proxy: yes
status_code: 204
return_content: no
validate_certs: no
force_basic_auth: yes
headers:
Content-Type: "application/json"
Accept: "application/json"
register: reboot_result
changed_when: reboot_result.status == 204
when: job_result.json.TaskState == 'Pending' and job_result.json.Messages.0.Message == 'Task successfully scheduled.'
- name: "View the job details to verify if the task status is completed."
uri:
url: "https://{{ baseuri }}{{ result.task.uri }}"
user: "{{ username }}"
password: "{{ password }}"
method: "GET"
use_proxy: yes
status_code: 200, 202
return_content: yes
validate_certs: no
force_basic_auth: yes
headers:
Content-Type: "application/json"
Accept: "application/json"
register: final_result
failed_when: final_result.json.TaskState == "Completed" and final_result.json.TaskStatus != "OK"
until: final_result.json.TaskState == 'Completed'
retries: "{{ retries_count }}"
delay: "{{ polling_interval }}"

View File

@@ -0,0 +1,88 @@
---
- hosts: redfish_hosts
connection: local
gather_facts: false
name: "Redfish Storage Volume - Ansible Module"
vars:
retries_count: 100
polling_interval: 10
reboot_uri: "/redfish/v1/Systems/System.Embedded.1/Actions/ComputerSystem.Reset"
collections:
- dellemc.openmanage
tasks:
- name: "Initialize an existing volume."
redfish_storage_volume:
baseuri: "{{ baseuri }}"
username: "{{ username }}"
password: "{{ password }}"
ca_path: "/path/to/ca_cert.pem"
command: "initialize"
volume_id: "Disk.Virtual.1:RAID.Slot.1-1"
initialize_type: "Slow"
register: result
tags:
- initialize_volume
- name: "View the job details to track the status of the initialization task"
uri:
url: "https://{{ baseuri }}{{ result.task.uri }}"
user: "{{ username }}"
password: "{{ password }}"
method: "GET"
use_proxy: yes
status_code: 200, 202
return_content: yes
validate_certs: no
force_basic_auth: yes
headers:
Content-Type: "application/json"
Accept: "application/json"
register: job_result
failed_when: "'json' not in job_result"
until: job_result.json.TaskState == 'Completed' or job_result.json.TaskState == 'Pending'
retries: "{{ retries_count }}"
delay: "{{ polling_interval }}"
tags:
- job-tracking
- name: "Reboot the system if the job status is pending."
uri:
url: "https://{{ baseuri }}{{ reboot_uri }}"
user: "{{ username }}"
password: "{{ password }}"
method: "POST"
body_format: raw
body: '{"ResetType": "ForceRestart"}'
use_proxy: yes
status_code: 204
return_content: no
validate_certs: no
force_basic_auth: yes
headers:
Content-Type: "application/json"
Accept: "application/json"
register: reboot_result
changed_when: reboot_result.status == 204
when: job_result.json.TaskState == 'Pending' and job_result.json.Messages.0.Message == 'Task successfully scheduled.'
- name: "View the job details to verify if the task status is completed."
uri:
url: "https://{{ baseuri }}{{ result.task.uri }}"
user: "{{ username }}"
password: "{{ password }}"
method: "GET"
use_proxy: yes
status_code: 200, 202
return_content: yes
validate_certs: no
force_basic_auth: yes
headers:
Content-Type: "application/json"
Accept: "application/json"
register: final_result
failed_when: final_result.json.TaskState == "Completed" and final_result.json.TaskStatus != "OK"
until: final_result.json.TaskState == 'Completed'
retries: "{{ retries_count }}"
delay: "{{ polling_interval }}"

View File

@@ -0,0 +1,89 @@
---
- hosts: redfish_hosts
connection: local
gather_facts: false
name: "Redfish Storage Volume - Ansible Module"
vars:
retries_count: 100
polling_interval: 10
reboot_uri: "/redfish/v1/Systems/System.Embedded.1/Actions/ComputerSystem.Reset"
collections:
- dellemc.openmanage
tasks:
- name: "Modify storage volume encryption settings."
redfish_storage_volume:
baseuri: "{{ baseuri }}"
username: "{{ username }}"
password: "{{ password }}"
ca_path: "/path/to/ca_cert.pem"
state: "present"
volume_id: "Disk.Virtual.1:RAID.Slot.1-1"
encryption_types: "ControllerAssisted"
encrypted: true
register: result
tags:
- modify_volume
- name: "View the job details to track the status of the modify storage volume encryption task"
uri:
url: "https://{{ baseuri }}{{ result.task.uri }}"
user: "{{ username }}"
password: "{{ password }}"
method: "GET"
use_proxy: yes
status_code: 200, 202
return_content: yes
validate_certs: no
force_basic_auth: yes
headers:
Content-Type: "application/json"
Accept: "application/json"
register: job_result
failed_when: "'json' not in job_result"
until: job_result.json.TaskState == 'Completed' or job_result.json.TaskState == 'Pending'
retries: "{{ retries_count }}"
delay: "{{ polling_interval }}"
tags:
- job-tracking
- name: "Reboot the system if the job status is pending."
uri:
url: "https://{{ baseuri }}{{ reboot_uri }}"
user: "{{ username }}"
password: "{{ password }}"
method: "POST"
body_format: raw
body: '{"ResetType": "ForceRestart"}'
use_proxy: yes
status_code: 204
return_content: no
validate_certs: no
force_basic_auth: yes
headers:
Content-Type: "application/json"
Accept: "application/json"
register: reboot_result
changed_when: reboot_result.status == 204
when: job_result.json.TaskState == 'Pending' and job_result.json.Messages.0.Message == 'Task successfully scheduled.'
- name: "View the job details to verify if the task status is completed."
uri:
url: "https://{{ baseuri }}{{ result.task.uri }}"
user: "{{ username }}"
password: "{{ password }}"
method: "GET"
use_proxy: yes
status_code: 200, 202
return_content: yes
validate_certs: no
force_basic_auth: yes
headers:
Content-Type: "application/json"
Accept: "application/json"
register: final_result
failed_when: final_result.json.TaskState == "Completed" and final_result.json.TaskStatus != "OK"
until: final_result.json.TaskState == 'Completed'
retries: "{{ retries_count }}"
delay: "{{ polling_interval }}"