| 1 |
.. _ome_alert_policies_module: |
| 2 |
|
| 3 |
|
| 4 |
ome_alert_policies -- Manage OME alert policies. |
| 5 |
================================================ |
| 6 |
|
| 7 |
.. contents:: |
| 8 |
:local: |
| 9 |
:depth: 1 |
| 10 |
|
| 11 |
|
| 12 |
Synopsis |
| 13 |
-------- |
| 14 |
|
| 15 |
This module allows you to create, modify, or delete alert policies on OpenManage Enterprise or OpenManage Enterprise Modular. |
| 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 |
name (True, list, None) |
| 31 |
Name of an alert policy or a list of alert policies. |
| 32 |
|
| 33 |
More than one policy name is applicable when \ :emphasis:`state`\ is \ :literal:`absent`\ and \ :emphasis:`state`\ is \ :literal:`present`\ with only \ :emphasis:`enable`\ provided. |
| 34 |
|
| 35 |
|
| 36 |
state (optional, str, present) |
| 37 |
\ :literal:`present`\ allows you to create an alert policy or update if the policy name already exists. |
| 38 |
|
| 39 |
\ :literal:`absent`\ allows you to delete an alert policy. |
| 40 |
|
| 41 |
|
| 42 |
enable (optional, bool, None) |
| 43 |
\ :literal:`true`\ allows you to enable an alert policy. |
| 44 |
|
| 45 |
\ :literal:`false`\ allows you to disable an alert policy. |
| 46 |
|
| 47 |
This is applicable only when \ :emphasis:`state`\ is \ :literal:`present`\ . |
| 48 |
|
| 49 |
|
| 50 |
new_name (optional, str, None) |
| 51 |
New name for the alert policy. |
| 52 |
|
| 53 |
This is applicable only when \ :emphasis:`state`\ is \ :literal:`present`\ , and an alert policy exists. |
| 54 |
|
| 55 |
|
| 56 |
description (optional, str, None) |
| 57 |
Description for the alert policy. |
| 58 |
|
| 59 |
This is applicable only when \ :emphasis:`state`\ is \ :literal:`present`\ |
| 60 |
|
| 61 |
|
| 62 |
device_service_tag (optional, list, None) |
| 63 |
List of device service tags on which the alert policy will be applicable. |
| 64 |
|
| 65 |
This option is mutually exclusive with \ :emphasis:`device\_group`\ , \ :emphasis:`specific\_undiscovered\_devices`\ , \ :emphasis:`any\_undiscovered\_devices`\ and \ :emphasis:`all\_devices`\ . |
| 66 |
|
| 67 |
This is applicable only when \ :emphasis:`state`\ is \ :literal:`present`\ |
| 68 |
|
| 69 |
|
| 70 |
device_group (optional, list, None) |
| 71 |
List of device group names on which the alert policy is applicable. |
| 72 |
|
| 73 |
This option is mutually exclusive with \ :emphasis:`device\_service\_tag`\ , \ :emphasis:`specific\_undiscovered\_devices`\ , \ :emphasis:`any\_undiscovered\_devices`\ and \ :emphasis:`all\_devices`\ . |
| 74 |
|
| 75 |
This is applicable only when \ :emphasis:`state`\ is \ :literal:`present`\ |
| 76 |
|
| 77 |
|
| 78 |
specific_undiscovered_devices (optional, list, None) |
| 79 |
List of undiscovered IPs, hostnames, or range of IPs of devices on which the alert policy is applicable. |
| 80 |
|
| 81 |
This option is mutually exclusive with \ :emphasis:`device\_service\_tag`\ , \ :emphasis:`device\_group`\ , \ :emphasis:`any\_undiscovered\_devices`\ and \ :emphasis:`all\_devices`\ . |
| 82 |
|
| 83 |
This is applicable only when \ :emphasis:`state`\ is \ :literal:`present`\ |
| 84 |
|
| 85 |
Examples of valid IP range format: |
| 86 |
|
| 87 |
10.35.0.0 |
| 88 |
|
| 89 |
10.36.0.0-10.36.0.255 |
| 90 |
|
| 91 |
10.37.0.0/24 |
| 92 |
|
| 93 |
2607:f2b1:f083:135::5500/118 |
| 94 |
|
| 95 |
2607:f2b1:f083:135::a500-2607:f2b1:f083:135::a600 |
| 96 |
|
| 97 |
hostname.domain.com |
| 98 |
|
| 99 |
Examples of invalid IP range format: |
| 100 |
|
| 101 |
10.35.0.\* |
| 102 |
|
| 103 |
10.36.0.0-255 |
| 104 |
|
| 105 |
10.35.0.0/255.255.255.0 |
| 106 |
|
| 107 |
These values will not be validated. |
| 108 |
|
| 109 |
|
| 110 |
any_undiscovered_devices (optional, bool, None) |
| 111 |
This option indicates whether the alert policy is applicable to any undiscovered devices or not. |
| 112 |
|
| 113 |
This option is mutually exclusive with \ :emphasis:`device\_service\_tag`\ , \ :emphasis:`specific\_undiscovered\_devices`\ , \ :emphasis:`device\_group`\ and \ :emphasis:`all\_devices`\ . |
| 114 |
|
| 115 |
This is applicable only when \ :emphasis:`state`\ is \ :literal:`present`\ . |
| 116 |
|
| 117 |
|
| 118 |
all_devices (optional, bool, None) |
| 119 |
This option indicates whether the alert policy is applicable to all the discovered and undiscovered devices or not. |
| 120 |
|
| 121 |
This option is mutually exclusive with \ :emphasis:`device\_service\_tag`\ , \ :emphasis:`specific\_undiscovered\_devices`\ , \ :emphasis:`any\_undiscovered\_devices`\ and \ :emphasis:`device\_group`\ . |
| 122 |
|
| 123 |
This is applicable only when \ :emphasis:`state`\ is \ :literal:`present`\ . |
| 124 |
|
| 125 |
|
| 126 |
category (optional, list, None) |
| 127 |
Category of the alerts received. |
| 128 |
|
| 129 |
This is mutually exclusive with the \ :emphasis:`message\_ids`\ , \ :emphasis:`message\_file`\ . |
| 130 |
|
| 131 |
This is fetched from the \ :ref:`dellemc.openmanage.ome\_alert\_policies\_category\_info <ansible_collections.dellemc.openmanage.ome_alert_policies_category_info_module>`\ . |
| 132 |
|
| 133 |
This is applicable only when \ :emphasis:`state`\ is \ :literal:`present`\ . |
| 134 |
|
| 135 |
|
| 136 |
catalog_name (True, str, None) |
| 137 |
Name of the catalog. |
| 138 |
|
| 139 |
|
| 140 |
catalog_category (optional, list, None) |
| 141 |
Category of the catalog. |
| 142 |
|
| 143 |
|
| 144 |
category_name (optional, str, None) |
| 145 |
Name of the category. |
| 146 |
|
| 147 |
|
| 148 |
sub_category_names (optional, list, None) |
| 149 |
List of sub-categories. |
| 150 |
|
| 151 |
|
| 152 |
|
| 153 |
|
| 154 |
message_ids (optional, list, None) |
| 155 |
List of Message ids |
| 156 |
|
| 157 |
This is mutually exclusive with the \ :emphasis:`category`\ , \ :emphasis:`message\_file`\ |
| 158 |
|
| 159 |
This is applicable only when \ :emphasis:`state`\ is \ :literal:`present`\ |
| 160 |
|
| 161 |
This is fetched from the \ :ref:`dellemc.openmanage.ome\_alert\_policies\_message\_id\_info <ansible_collections.dellemc.openmanage.ome_alert_policies_message_id_info_module>`\ . |
| 162 |
|
| 163 |
|
| 164 |
message_file (optional, path, None) |
| 165 |
Local path of a CSV formatted file with message IDs |
| 166 |
|
| 167 |
This is mutually exclusive with the \ :emphasis:`category`\ , \ :emphasis:`message\_ids`\ |
| 168 |
|
| 169 |
This is applicable only when \ :emphasis:`state`\ is \ :literal:`present`\ |
| 170 |
|
| 171 |
This is fetched from the \ :ref:`dellemc.openmanage.ome\_alert\_policies\_message\_id\_info <ansible_collections.dellemc.openmanage.ome_alert_policies_message_id_info_module>`\ . |
| 172 |
|
| 173 |
|
| 174 |
date_and_time (optional, dict, None) |
| 175 |
Specifies the schedule for when the alert policy is applicable. |
| 176 |
|
| 177 |
\ :emphasis:`date\_and\_time`\ is mandatory for creating a policy and optional when updating a policy. |
| 178 |
|
| 179 |
This is applicable only when \ :emphasis:`state`\ is \ :literal:`present`\ . |
| 180 |
|
| 181 |
|
| 182 |
date_from (True, str, None) |
| 183 |
Start date in the format YYYY-MM-DD. |
| 184 |
|
| 185 |
This parameter to be provided in quotes. |
| 186 |
|
| 187 |
|
| 188 |
date_to (optional, str, None) |
| 189 |
End date in the format YYYY-MM-DD. |
| 190 |
|
| 191 |
This parameter to be provided in quotes. |
| 192 |
|
| 193 |
|
| 194 |
time_from (optional, str, None) |
| 195 |
Interval start time in the format HH:MM |
| 196 |
|
| 197 |
This parameter to be provided in quotes. |
| 198 |
|
| 199 |
This is mandatory when \ :emphasis:`time\_interval`\ is \ :literal:`true`\ . |
| 200 |
|
| 201 |
|
| 202 |
time_to (optional, str, None) |
| 203 |
Interval end time in the format HH:MM |
| 204 |
|
| 205 |
This parameter to be provided in quotes. |
| 206 |
|
| 207 |
This is mandatory when \ :emphasis:`time\_interval`\ is \ :literal:`true`\ |
| 208 |
|
| 209 |
|
| 210 |
days (optional, list, None) |
| 211 |
Required days of the week on which alert policy operation must be scheduled. |
| 212 |
|
| 213 |
|
| 214 |
time_interval (optional, bool, None) |
| 215 |
Enable the time interval for which alert policy must be scheduled. |
| 216 |
|
| 217 |
|
| 218 |
|
| 219 |
severity (optional, list, None) |
| 220 |
Severity of the alert policy. |
| 221 |
|
| 222 |
This is mandatory for creating a policy and optional for updating a policy. |
| 223 |
|
| 224 |
This is applicable only when \ :emphasis:`state`\ is \ :literal:`present`\ . |
| 225 |
|
| 226 |
|
| 227 |
actions (optional, list, None) |
| 228 |
Actions to be triggered for the alert policy. |
| 229 |
|
| 230 |
This parameter is case-sensitive. |
| 231 |
|
| 232 |
This is mandatory for creating a policy and optional for updating a policy. |
| 233 |
|
| 234 |
This is applicable only when \ :emphasis:`state`\ is \ :literal:`present`\ |
| 235 |
|
| 236 |
|
| 237 |
action_name (True, str, None) |
| 238 |
Name of the action. |
| 239 |
|
| 240 |
This is fetched from the \ :ref:`dellemc.openmanage.ome\_alert\_policies\_action\_info <ansible_collections.dellemc.openmanage.ome_alert_policies_action_info_module>`\ . |
| 241 |
|
| 242 |
This is mandatory for creating a policy and optional for updating a policy. |
| 243 |
|
| 244 |
This parameter is case-sensitive. |
| 245 |
|
| 246 |
|
| 247 |
parameters (optional, list, []) |
| 248 |
Predefined parameters required to set for \ :emphasis:`action\_name`\ . |
| 249 |
|
| 250 |
|
| 251 |
name (optional, str, None) |
| 252 |
Name of the predefined parameter. |
| 253 |
|
| 254 |
This is fetched from the \ :ref:`dellemc.openmanage.ome\_alert\_policies\_action\_info <ansible_collections.dellemc.openmanage.ome_alert_policies_action_info_module>`\ . |
| 255 |
|
| 256 |
|
| 257 |
value (optional, str, None) |
| 258 |
Value of the predefined parameter. |
| 259 |
|
| 260 |
These values will not be validated. |
| 261 |
|
| 262 |
|
| 263 |
|
| 264 |
|
| 265 |
hostname (True, str, None) |
| 266 |
OpenManage Enterprise or OpenManage Enterprise Modular IP address or hostname. |
| 267 |
|
| 268 |
|
| 269 |
username (False, str, None) |
| 270 |
OpenManage Enterprise or OpenManage Enterprise Modular username. |
| 271 |
|
| 272 |
If the username is not provided, then the environment variable \ :envvar:`OME\_USERNAME`\ is used. |
| 273 |
|
| 274 |
Example: export OME\_USERNAME=username |
| 275 |
|
| 276 |
|
| 277 |
password (False, str, None) |
| 278 |
OpenManage Enterprise or OpenManage Enterprise Modular password. |
| 279 |
|
| 280 |
If the password is not provided, then the environment variable \ :envvar:`OME\_PASSWORD`\ is used. |
| 281 |
|
| 282 |
Example: export OME\_PASSWORD=password |
| 283 |
|
| 284 |
|
| 285 |
x_auth_token (False, str, None) |
| 286 |
Authentication token. |
| 287 |
|
| 288 |
If the x\_auth\_token is not provided, then the environment variable \ :envvar:`OME\_X\_AUTH\_TOKEN`\ is used. |
| 289 |
|
| 290 |
Example: export OME\_X\_AUTH\_TOKEN=x\_auth\_token |
| 291 |
|
| 292 |
|
| 293 |
port (optional, int, 443) |
| 294 |
OpenManage Enterprise or OpenManage Enterprise Modular HTTPS port. |
| 295 |
|
| 296 |
|
| 297 |
validate_certs (optional, bool, True) |
| 298 |
If \ :literal:`false`\ , the SSL certificates will not be validated. |
| 299 |
|
| 300 |
Configure \ :literal:`false`\ only on personally controlled sites where self-signed certificates are used. |
| 301 |
|
| 302 |
Prior to collection version \ :literal:`5.0.0`\ , the \ :emphasis:`validate\_certs`\ is \ :literal:`false`\ by default. |
| 303 |
|
| 304 |
|
| 305 |
ca_path (optional, path, None) |
| 306 |
The Privacy Enhanced Mail (PEM) file that contains a CA certificate to be used for the validation. |
| 307 |
|
| 308 |
|
| 309 |
timeout (optional, int, 30) |
| 310 |
The socket level timeout in seconds. |
| 311 |
|
| 312 |
|
| 313 |
|
| 314 |
|
| 315 |
|
| 316 |
Notes |
| 317 |
----- |
| 318 |
|
| 319 |
.. note:: |
| 320 |
- Run this module from a system that has direct access to Dell OpenManage Enterprise or OpenManage Enterprise Modular. |
| 321 |
- This module supports IPv4 and IPv6 addresses. |
| 322 |
- This module supports \ :literal:`check\_mode`\ . |
| 323 |
|
| 324 |
|
| 325 |
|
| 326 |
|
| 327 |
Examples |
| 328 |
-------- |
| 329 |
|
| 330 |
.. code-block:: yaml+jinja |
| 331 |
|
| 332 |
|
| 333 |
--- |
| 334 |
- name: "Create an alert policy" |
| 335 |
dellemc.openamanage.ome_alert_policies: |
| 336 |
hostname: "192.168.0.1" |
| 337 |
username: "username" |
| 338 |
password: "password" |
| 339 |
ca_path: "/path/to/ca_cert.pem" |
| 340 |
name: "Alert Policy One" |
| 341 |
device_service_tag: |
| 342 |
- ABCD123 |
| 343 |
- SVC7845 |
| 344 |
category: |
| 345 |
- catalog_name: Application |
| 346 |
catalog_category: |
| 347 |
- category_name: Audit |
| 348 |
sub_category_names: |
| 349 |
- Generic |
| 350 |
- Devices |
| 351 |
- catalog_name: iDRAC |
| 352 |
catalog_category: |
| 353 |
- category_name: Audit |
| 354 |
sub_category_names: |
| 355 |
- BIOS Management |
| 356 |
- iDRAC Service Module |
| 357 |
date_and_time: |
| 358 |
date_from: "2023-10-10" |
| 359 |
date_to: "2023-10-11" |
| 360 |
time_from: "11:00" |
| 361 |
time_to: "12:00" |
| 362 |
severity: |
| 363 |
- unknown |
| 364 |
- critical |
| 365 |
actions: |
| 366 |
- action_name: Trap |
| 367 |
parameters: |
| 368 |
- name: "192.1.2.3:162" |
| 369 |
value: true |
| 370 |
- name: "traphostname.domain.com:162" |
| 371 |
value: true |
| 372 |
tags: create_alert_policy |
| 373 |
|
| 374 |
- name: "Update an alert Policy" |
| 375 |
dellemc.openamanage.ome_alert_policies: |
| 376 |
hostname: "192.168.0.1" |
| 377 |
username: "username" |
| 378 |
password: "password" |
| 379 |
ca_path: "/path/to/ca_cert.pem" |
| 380 |
new_name: "Update Policy Name" |
| 381 |
device_group: "Group Name" |
| 382 |
message_ids: |
| 383 |
- AMP400 |
| 384 |
- CTL201 |
| 385 |
- BIOS101 |
| 386 |
date_and_time: |
| 387 |
date_from: "2023-10-10" |
| 388 |
date_to: "2023-10-11" |
| 389 |
time_from: "11:00" |
| 390 |
time_to: "12:00" |
| 391 |
time_interval: true |
| 392 |
actions: |
| 393 |
- action_name: Trap |
| 394 |
parameters: |
| 395 |
- name: "192.1.2.3:162" |
| 396 |
value: true |
| 397 |
tags: update_alert_policy |
| 398 |
|
| 399 |
- name: "Enable an alert policy" |
| 400 |
dellemc.openamanage.ome_alert_policies: |
| 401 |
hostname: "192.168.0.1" |
| 402 |
username: "username" |
| 403 |
password: "password" |
| 404 |
ca_path: "/path/to/ca_cert.pem" |
| 405 |
name: "Policy Name" |
| 406 |
enable: true |
| 407 |
tags: enable_alert_policy |
| 408 |
|
| 409 |
- name: "Disable multiple alert policies" |
| 410 |
dellemc.openamanage.ome_alert_policies: |
| 411 |
hostname: "192.168.0.1" |
| 412 |
username: "username" |
| 413 |
password: "password" |
| 414 |
ca_path: "/path/to/ca_cert.pem" |
| 415 |
name: |
| 416 |
- "Policy Name 1" |
| 417 |
- "Policy Name 2" |
| 418 |
enable: false |
| 419 |
tags: disable_alert_policy |
| 420 |
|
| 421 |
- name: "Delete an alert policy" |
| 422 |
dellemc.openamanage.ome_alert_policies: |
| 423 |
hostname: "192.168.0.1" |
| 424 |
username: "username" |
| 425 |
password: "password" |
| 426 |
ca_path: "/path/to/ca_cert.pem" |
| 427 |
name: |
| 428 |
- "Policy Name" |
| 429 |
state: absent |
| 430 |
tags: delete_alert_policy |
| 431 |
|
| 432 |
|
| 433 |
|
| 434 |
Return Values |
| 435 |
------------- |
| 436 |
|
| 437 |
msg (always, str, Successfully created the alert policy.) |
| 438 |
Status of the alert policies operation. |
| 439 |
|
| 440 |
|
| 441 |
status (when state is present, dict, {'Id': 12345, 'Name': 'Policy', 'Description': 'Details of the Policy', 'Enabled': True, 'DefaultPolicy': False, 'Editable': True, 'Visible': True, 'PolicyData': {'Catalogs': [{'CatalogName': 'iDRAC', 'Categories': [4], 'SubCategories': [41]}, {'CatalogName': 'Application', 'Categories': [0], 'SubCategories': [0]}], 'Severities': [16, 1, 2, 4, 8], 'Devices': [10086, 10088], 'DeviceTypes': [1000, 2000], 'Groups': [], 'Schedule': {'StartTime': '2023-06-06 15:02:46.000', 'EndTime': '2023-06-06 18:02:46.000', 'CronString': '* * * ? * * *'}, 'Actions': [{'Id': 8, 'Name': 'Email', 'ParameterDetails': [{'Id': 1, 'Name': 'subject', 'Value': 'Device Name: $name, Device IP Address: $ip, Severity: $severity', 'Type': 'string', 'TypeParams': [{'Name': 'maxLength', 'Value': '255'}]}, {'Id': 1, 'Name': 'to', 'Value': '[email protected]', 'Type': 'string', 'TypeParams': [{'Name': 'maxLength', 'Value': '255'}]}, {'Id': 1, 'Name': 'from', 'Value': '[email protected]', 'Type': 'string', 'TypeParams': [{'Name': 'maxLength', 'Value': '255'}]}, {'Id': 1, 'Name': 'message', 'Value': 'Event occurred for Device Name: $name, Device IP Address: $ip', 'Type': 'string', 'TypeParams': [{'Name': 'maxLength', 'Value': '255'}]}]}], 'UndiscoveredTargets': [], 'State': True, 'Owner': 10069}}) |
| 442 |
The policy which was created or modified. |
| 443 |
|
| 444 |
|
| 445 |
error_info (on HTTP error, dict, {'error': {'code': 'Base.1.0.GeneralError', 'message': 'A general error has occurred. See ExtendedInfo for more information.', '@Message.ExtendedInfo': [{'MessageId': 'CMON7011', 'RelatedProperties': [], 'Message': 'Unable to create or modify the alert policy because an invalid value [To Email] is entered for the action Email.', 'MessageArgs': ['[To Email]', 'Email'], 'Severity': 'Warning', 'Resolution': 'Enter a valid value for the action identified in the message and retry the operation.'}]}}) |
| 446 |
Details of the HTTP Error. |
| 447 |
|
| 448 |
|
| 449 |
|
| 450 |
|
| 451 |
|
| 452 |
Status |
| 453 |
------ |
| 454 |
|
| 455 |
|
| 456 |
|
| 457 |
|
| 458 |
|
| 459 |
Authors |
| 460 |
~~~~~~~ |
| 461 |
|
| 462 |
- Jagadeesh N V(@jagadeeshnv) |
| 463 |
|