| 1 |
.. _redfish_event_subscription_module: |
| 2 |
|
| 3 |
|
| 4 |
redfish_event_subscription -- Manage Redfish Subscriptions |
| 5 |
========================================================== |
| 6 |
|
| 7 |
.. contents:: |
| 8 |
:local: |
| 9 |
:depth: 1 |
| 10 |
|
| 11 |
|
| 12 |
Synopsis |
| 13 |
-------- |
| 14 |
|
| 15 |
This module allows to add or delete Redfish Event subscriptions. |
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
Requirements |
| 20 |
------------ |
| 21 |
The below requirements are needed on the host that executes this module. |
| 22 |
|
| 23 |
- python \>= 3.9.6 |
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
Parameters |
| 28 |
---------- |
| 29 |
|
| 30 |
destination (True, str, None) |
| 31 |
The HTTPS URI of the destination to send events. |
| 32 |
|
| 33 |
HTTPS is required. |
| 34 |
|
| 35 |
|
| 36 |
event_type (optional, str, Alert) |
| 37 |
Specifies the event type to be subscribed. |
| 38 |
|
| 39 |
\ :literal:`Alert`\ used to subscribe for alert. |
| 40 |
|
| 41 |
\ :literal:`MetricReport`\ used to subscribe for the metrics report. |
| 42 |
|
| 43 |
|
| 44 |
event_format_type (optional, str, Event) |
| 45 |
Specifies the format type of the event to be subscribed. |
| 46 |
|
| 47 |
\ :literal:`Event`\ used to subscribe for Event format type. |
| 48 |
|
| 49 |
\ :literal:`MetricReport`\ used to subscribe for the metrics report format type. |
| 50 |
|
| 51 |
|
| 52 |
state (optional, str, present) |
| 53 |
\ :literal:`present`\ adds new event subscription. |
| 54 |
|
| 55 |
\ :literal:`absent`\ deletes event subscription with the specified \ :emphasis:`destination`\ . |
| 56 |
|
| 57 |
|
| 58 |
baseuri (True, str, None) |
| 59 |
IP address of the target out-of-band controller. For example- \<ipaddress\>:\<port\>. |
| 60 |
|
| 61 |
|
| 62 |
username (False, str, None) |
| 63 |
Username of the target out-of-band controller. |
| 64 |
|
| 65 |
If the username is not provided, then the environment variable \ :envvar:`IDRAC\_USERNAME`\ is used. |
| 66 |
|
| 67 |
Example: export IDRAC\_USERNAME=username |
| 68 |
|
| 69 |
|
| 70 |
password (False, str, None) |
| 71 |
Password of the target out-of-band controller. |
| 72 |
|
| 73 |
If the password is not provided, then the environment variable \ :envvar:`IDRAC\_PASSWORD`\ is used. |
| 74 |
|
| 75 |
Example: export IDRAC\_PASSWORD=password |
| 76 |
|
| 77 |
|
| 78 |
x_auth_token (False, str, None) |
| 79 |
Authentication token. |
| 80 |
|
| 81 |
If the x\_auth\_token is not provided, then the environment variable \ :envvar:`IDRAC\_X\_AUTH\_TOKEN`\ is used. |
| 82 |
|
| 83 |
Example: export IDRAC\_X\_AUTH\_TOKEN=x\_auth\_token |
| 84 |
|
| 85 |
|
| 86 |
validate_certs (optional, bool, True) |
| 87 |
If \ :literal:`false`\ , the SSL certificates will not be validated. |
| 88 |
|
| 89 |
Configure \ :literal:`false`\ only on personally controlled sites where self-signed certificates are used. |
| 90 |
|
| 91 |
Prior to collection version \ :literal:`5.0.0`\ , the \ :emphasis:`validate\_certs`\ is \ :literal:`false`\ by default. |
| 92 |
|
| 93 |
|
| 94 |
ca_path (optional, path, None) |
| 95 |
The Privacy Enhanced Mail (PEM) file that contains a CA certificate to be used for the validation. |
| 96 |
|
| 97 |
|
| 98 |
timeout (optional, int, 30) |
| 99 |
The socket level timeout in seconds. |
| 100 |
|
| 101 |
|
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
Notes |
| 106 |
----- |
| 107 |
|
| 108 |
.. note:: |
| 109 |
- \ :emphasis:`event\_type`\ needs to be \ :literal:`MetricReport`\ and \ :emphasis:`event\_format\_type`\ needs to be \ :literal:`MetricReport`\ for metrics subscription. |
| 110 |
- \ :emphasis:`event\_type`\ needs to be \ :literal:`Alert`\ and \ :emphasis:`event\_format\_type`\ needs to be \ :literal:`Event`\ for event subscription. |
| 111 |
- Modifying a subscription is not supported. |
| 112 |
- Context is always set to RedfishEvent. |
| 113 |
- This module supports \ :literal:`check\_mode`\ . |
| 114 |
|
| 115 |
|
| 116 |
|
| 117 |
|
| 118 |
Examples |
| 119 |
-------- |
| 120 |
|
| 121 |
.. code-block:: yaml+jinja |
| 122 |
|
| 123 |
|
| 124 |
--- |
| 125 |
- name: Add Redfish metric subscription |
| 126 |
redfish_event_subscription: |
| 127 |
baseuri: "192.168.0.1" |
| 128 |
username: "user_name" |
| 129 |
password: "user_password" |
| 130 |
ca_path: "/path/to/ca_cert.pem" |
| 131 |
destination: "https://192.168.1.100:8188" |
| 132 |
event_type: MetricReport |
| 133 |
event_format_type: MetricReport |
| 134 |
state: present |
| 135 |
|
| 136 |
- name: Add Redfish alert subscription |
| 137 |
redfish_event_subscription: |
| 138 |
baseuri: "192.168.0.1" |
| 139 |
username: "user_name" |
| 140 |
password: "user_password" |
| 141 |
ca_path: "/path/to/ca_cert.pem" |
| 142 |
destination: "https://server01.example.com:8188" |
| 143 |
event_type: Alert |
| 144 |
event_format_type: Event |
| 145 |
state: present |
| 146 |
|
| 147 |
- name: Delete Redfish subscription with a specified destination |
| 148 |
redfish_event_subscription: |
| 149 |
baseuri: "192.168.0.1" |
| 150 |
username: "user_name" |
| 151 |
password: "user_password" |
| 152 |
ca_path: "/path/to/ca_cert.pem" |
| 153 |
destination: "https://server01.example.com:8188" |
| 154 |
state: absent |
| 155 |
|
| 156 |
|
| 157 |
|
| 158 |
Return Values |
| 159 |
------------- |
| 160 |
|
| 161 |
msg (always, str, Successfully added the subscription.) |
| 162 |
Overall status of the task. |
| 163 |
|
| 164 |
|
| 165 |
status (on adding subscription successfully, dict, {'@Message.ExtendedInfo': [{'Message': 'The resource has been created successfully', 'MessageArgs': [], '[email protected]': 0, 'MessageId': 'Base.1.7.Created', 'RelatedProperties': [], '[email protected]': 0, 'Resolution': 'None', 'Severity': 'OK'}, {'Message': 'A new resource is successfully created.', 'MessageArgs': [], '[email protected]': 0, 'MessageId': 'IDRAC.2.2.SYS414', 'RelatedProperties': [], '[email protected]': 0, 'Resolution': 'No response action is required.', 'Severity': 'Informational'}], 'Actions': {'#EventDestination.ResumeSubscription': {'target': '/redfish/v1/EventService/Subscriptions/5d432f36-81f4-11eb-9dc0-2cea7ff7ff9a/Actions/EventDestination.ResumeSubscription'}}, 'Context': 'RedfishEvent', 'DeliveryRetryPolicy': 'RetryForever', 'Description': 'Event Subscription Details', 'Destination': 'https://192.168.1.100:8188', 'EventFormatType': 'Event', 'EventTypes': ['Alert'], '[email protected]': 1, 'HttpHeaders': [], '[email protected]': 0, 'Id': '5d432f36-81f4-11eb-9dc0-2cea7ff7ff9a', 'MetricReportDefinitions': [], '[email protected]': 0, 'Name': 'EventSubscription 5d432f36-81f4-11eb-9dc0-2cea7ff7ff9a', 'OriginResources': [], '[email protected]': 0, 'Protocol': 'Redfish', 'Status': {'Health': 'OK', 'HealthRollup': 'OK', 'State': 'Enabled'}, 'SubscriptionType': 'RedfishEvent'}) |
| 166 |
Returns subscription object created |
| 167 |
|
| 168 |
|
| 169 |
error_info (on http error, dict, {'error': {'@Message.ExtendedInfo': [{'Message': 'Unable to complete the operation because the JSON data format entered is invalid.', 'Resolution': 'Do the following and the retry the operation: 1) Enter the correct JSON data format and retry the operation. 2) Make sure that no syntax error is present in JSON data format. 3) Make sure that a duplicate key is not present in JSON data format.', 'Severity': 'Critical'}, {'Message': 'The request body submitted was malformed JSON and could not be parsed by the receiving service.', 'Resolution': 'Ensure that the request body is valid JSON and resubmit the request.', 'Severity': 'Critical'}], 'code': 'Base.1.2.GeneralError', 'message': 'A general error has occurred. See ExtendedInfo for more information.'}}) |
| 170 |
Details of http error. |
| 171 |
|
| 172 |
|
| 173 |
|
| 174 |
|
| 175 |
|
| 176 |
Status |
| 177 |
------ |
| 178 |
|
| 179 |
|
| 180 |
|
| 181 |
|
| 182 |
|
| 183 |
Authors |
| 184 |
~~~~~~~ |
| 185 |
|
| 186 |
- Trevor Squillario (@TrevorSquillario) |
| 187 |
- Sachin Apagundi (@sachin-apa) |
| 188 |
|