| 1 |
.. _ome_configuration_compliance_baseline_module: |
| 2 |
|
| 3 |
|
| 4 |
ome_configuration_compliance_baseline -- Create, modify, and delete a configuration compliance baseline and remediate non-compliant devices on OpenManage Enterprise |
| 5 |
==================================================================================================================================================================== |
| 6 |
|
| 7 |
.. contents:: |
| 8 |
:local: |
| 9 |
:depth: 1 |
| 10 |
|
| 11 |
|
| 12 |
Synopsis |
| 13 |
-------- |
| 14 |
|
| 15 |
This module allows to create, modify, and delete a configuration compliance baseline on OpenManage Enterprise. This module also allows to remediate devices that are non-compliant with the baseline by changing the attributes of devices to match with the associated baseline attributes. |
| 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 |
command (optional, str, create) |
| 31 |
\ :literal:`create`\ creates a configuration baseline from an existing compliance template.\ :literal:`create`\ supports \ :literal:`check\_mode`\ or idempotency checking for only \ :emphasis:`names`\ . |
| 32 |
|
| 33 |
\ :literal:`modify`\ modifies an existing baseline.Only \ :emphasis:`names`\ , \ :emphasis:`description`\ , \ :emphasis:`device\_ids`\ , \ :emphasis:`device\_service\_tags`\ , and \ :emphasis:`device\_group\_names`\ can be modified |
| 34 |
|
| 35 |
\ :emphasis:`WARNING`\ When a baseline is modified, the provided \ :emphasis:`device\_ids`\ , \ :emphasis:`device\_group\_names`\ , and \ :emphasis:`device\_service\_tags`\ replaces the devices previously present in the baseline. |
| 36 |
|
| 37 |
\ :literal:`delete`\ deletes the list of configuration compliance baselines based on the baseline name. Invalid baseline names are ignored. |
| 38 |
|
| 39 |
\ :literal:`remediate`\ remediates devices that are non-compliant with the baseline by changing the attributes of devices to match with the associated baseline attributes. |
| 40 |
|
| 41 |
\ :literal:`remediate`\ is performed on all the non-compliant devices if either \ :emphasis:`device\_ids`\ , or \ :emphasis:`device\_service\_tags`\ is not provided. |
| 42 |
|
| 43 |
|
| 44 |
names (True, list, None) |
| 45 |
Name(s) of the configuration compliance baseline. |
| 46 |
|
| 47 |
This option is applicable when \ :emphasis:`command`\ is \ :literal:`create`\ , \ :literal:`modify`\ , or \ :literal:`delete`\ . |
| 48 |
|
| 49 |
Provide the list of configuration compliance baselines names that are supported when \ :emphasis:`command`\ is \ :literal:`delete`\ . |
| 50 |
|
| 51 |
|
| 52 |
new_name (optional, str, None) |
| 53 |
New name of the compliance baseline to be modified. |
| 54 |
|
| 55 |
This option is applicable when \ :emphasis:`command`\ is \ :literal:`modify`\ . |
| 56 |
|
| 57 |
|
| 58 |
template_name (optional, str, None) |
| 59 |
Name of the compliance template for creating the compliance baseline(s). |
| 60 |
|
| 61 |
Name of the deployment template to be used for creating a compliance baseline. |
| 62 |
|
| 63 |
This option is applicable when \ :emphasis:`command`\ is \ :literal:`create`\ and is mutually exclusive with \ :emphasis:`template\_id`\ . |
| 64 |
|
| 65 |
|
| 66 |
template_id (optional, int, None) |
| 67 |
ID of the deployment template to be used for creating a compliance baseline. |
| 68 |
|
| 69 |
This option is applicable when \ :emphasis:`command`\ is \ :literal:`create`\ and is mutually exclusive with \ :emphasis:`template\_name`\ . |
| 70 |
|
| 71 |
|
| 72 |
device_ids (optional, list, None) |
| 73 |
IDs of the target devices. |
| 74 |
|
| 75 |
This option is applicable when \ :emphasis:`command`\ is \ :literal:`create`\ , \ :literal:`modify`\ , or \ :literal:`remediate`\ , and is mutually exclusive with \ :emphasis:`device\_service\_tag`\ and \ :emphasis:`device\_group\_names`\ . |
| 76 |
|
| 77 |
|
| 78 |
device_service_tags (optional, list, None) |
| 79 |
Service tag of the target device. |
| 80 |
|
| 81 |
This option is applicable when \ :emphasis:`command`\ is \ :literal:`create`\ , \ :literal:`modify`\ , or \ :literal:`remediate`\ and is mutually exclusive with \ :emphasis:`device\_ids`\ and \ :emphasis:`device\_group\_names`\ . |
| 82 |
|
| 83 |
|
| 84 |
device_group_names (optional, list, None) |
| 85 |
Name of the target device group. |
| 86 |
|
| 87 |
This option is applicable when \ :emphasis:`command`\ is \ :literal:`create`\ , or \ :literal:`modify`\ and is mutually exclusive with \ :emphasis:`device\_ids`\ and \ :emphasis:`device\_service\_tag`\ . |
| 88 |
|
| 89 |
|
| 90 |
description (optional, str, None) |
| 91 |
Description of the compliance baseline. |
| 92 |
|
| 93 |
This option is applicable when \ :emphasis:`command`\ is \ :literal:`create`\ , or \ :literal:`modify`\ . |
| 94 |
|
| 95 |
|
| 96 |
run_later (optional, bool, None) |
| 97 |
Indicates whether to remediate immediately or in the future. |
| 98 |
|
| 99 |
This is applicable when \ :emphasis:`command`\ is \ :literal:`remediate`\ . |
| 100 |
|
| 101 |
If \ :emphasis:`run\_later`\ is \ :literal:`true`\ , then \ :emphasis:`staged\_at\_reboot`\ is ignored. |
| 102 |
|
| 103 |
If \ :emphasis:`run\_later`\ is \ :literal:`true`\ , then \ :emphasis:`job\_wait`\ is not applicable. |
| 104 |
|
| 105 |
If \ :emphasis:`run\_later`\ is \ :literal:`true`\ , then \ :emphasis:`cron`\ must be specified. |
| 106 |
|
| 107 |
|
| 108 |
cron (optional, str, None) |
| 109 |
Provide a cron expression based on Quartz cron format. |
| 110 |
|
| 111 |
Time format is "%S %M %H %d %m ? %Y". |
| 112 |
|
| 113 |
This is applicable when \ :emphasis:`run\_later`\ is \ :literal:`true`\ . |
| 114 |
|
| 115 |
|
| 116 |
staged_at_reboot (optional, bool, None) |
| 117 |
Indicates whether remediate has to be executed on next reboot. |
| 118 |
|
| 119 |
If \ :emphasis:`staged\_at\_reboot`\ is \ :literal:`true`\ , then remediation will occur during the next reboot. |
| 120 |
|
| 121 |
|
| 122 |
job_wait (optional, bool, True) |
| 123 |
Provides the option to wait for job completion. |
| 124 |
|
| 125 |
This option is applicable when \ :emphasis:`command`\ is \ :literal:`create`\ , \ :literal:`modify`\ , or \ :literal:`remediate`\ . |
| 126 |
|
| 127 |
|
| 128 |
job_wait_timeout (optional, int, 10800) |
| 129 |
The maximum wait time of \ :emphasis:`job\_wait`\ in seconds.The job will only be tracked for this duration. |
| 130 |
|
| 131 |
This option is applicable when \ :emphasis:`job\_wait`\ is \ :literal:`true`\ . |
| 132 |
|
| 133 |
|
| 134 |
hostname (True, str, None) |
| 135 |
OpenManage Enterprise IP address or hostname. |
| 136 |
|
| 137 |
|
| 138 |
username (False, str, None) |
| 139 |
OpenManage Enterprise username. |
| 140 |
|
| 141 |
If the username is not provided, then the environment variable \ :envvar:`OME\_USERNAME`\ is used. |
| 142 |
|
| 143 |
Example: export OME\_USERNAME=username |
| 144 |
|
| 145 |
|
| 146 |
password (False, str, None) |
| 147 |
OpenManage Enterprise password. |
| 148 |
|
| 149 |
If the password is not provided, then the environment variable \ :envvar:`OME\_PASSWORD`\ is used. |
| 150 |
|
| 151 |
Example: export OME\_PASSWORD=password |
| 152 |
|
| 153 |
|
| 154 |
x_auth_token (False, str, None) |
| 155 |
Authentication token. |
| 156 |
|
| 157 |
If the x\_auth\_token is not provided, then the environment variable \ :envvar:`OME\_X\_AUTH\_TOKEN`\ is used. |
| 158 |
|
| 159 |
Example: export OME\_X\_AUTH\_TOKEN=x\_auth\_token |
| 160 |
|
| 161 |
|
| 162 |
port (optional, int, 443) |
| 163 |
OpenManage Enterprise HTTPS port. |
| 164 |
|
| 165 |
|
| 166 |
validate_certs (optional, bool, True) |
| 167 |
If \ :literal:`false`\ , the SSL certificates will not be validated. |
| 168 |
|
| 169 |
Configure \ :literal:`false`\ only on personally controlled sites where self-signed certificates are used. |
| 170 |
|
| 171 |
Prior to collection version \ :literal:`5.0.0`\ , the \ :emphasis:`validate\_certs`\ is \ :literal:`false`\ by default. |
| 172 |
|
| 173 |
|
| 174 |
ca_path (optional, path, None) |
| 175 |
The Privacy Enhanced Mail (PEM) file that contains a CA certificate to be used for the validation. |
| 176 |
|
| 177 |
|
| 178 |
timeout (optional, int, 30) |
| 179 |
The socket level timeout in seconds. |
| 180 |
|
| 181 |
|
| 182 |
|
| 183 |
|
| 184 |
|
| 185 |
Notes |
| 186 |
----- |
| 187 |
|
| 188 |
.. note:: |
| 189 |
- This module supports \ :literal:`check\_mode`\ . |
| 190 |
- Ensure that the devices have the required licenses to perform the baseline compliance operations. |
| 191 |
|
| 192 |
|
| 193 |
|
| 194 |
|
| 195 |
Examples |
| 196 |
-------- |
| 197 |
|
| 198 |
.. code-block:: yaml+jinja |
| 199 |
|
| 200 |
|
| 201 |
--- |
| 202 |
- name: Create a configuration compliance baseline using device IDs |
| 203 |
dellemc.openmanage.ome_configuration_compliance_baseline: |
| 204 |
hostname: "192.168.0.1" |
| 205 |
username: "username" |
| 206 |
password: "password" |
| 207 |
ca_path: "/path/to/ca_cert.pem" |
| 208 |
names: "baseline1" |
| 209 |
template_name: "template1" |
| 210 |
description: "description of baseline" |
| 211 |
device_ids: |
| 212 |
- 1111 |
| 213 |
- 2222 |
| 214 |
|
| 215 |
- name: Create a configuration compliance baseline using device service tags |
| 216 |
dellemc.openmanage.ome_configuration_compliance_baseline: |
| 217 |
hostname: "192.168.0.1" |
| 218 |
username: "username" |
| 219 |
password: "password" |
| 220 |
ca_path: "/path/to/ca_cert.pem" |
| 221 |
names: "baseline1" |
| 222 |
template_id: 1234 |
| 223 |
description: "description of baseline" |
| 224 |
device_service_tags: |
| 225 |
- "SVCTAG1" |
| 226 |
- "SVCTAG2" |
| 227 |
|
| 228 |
- name: Create a configuration compliance baseline using group names |
| 229 |
dellemc.openmanage.ome_configuration_compliance_baseline: |
| 230 |
hostname: "192.168.0.1" |
| 231 |
username: "username" |
| 232 |
password: "password" |
| 233 |
ca_path: "/path/to/ca_cert.pem" |
| 234 |
names: "baseline2" |
| 235 |
template_id: 2 |
| 236 |
job_wait_timeout: 1000 |
| 237 |
description: "description of baseline" |
| 238 |
device_group_names: |
| 239 |
- "Group1" |
| 240 |
- "Group2" |
| 241 |
|
| 242 |
- name: Delete the configuration compliance baselines |
| 243 |
dellemc.openmanage.ome_configuration_compliance_baseline: |
| 244 |
hostname: "192.168.0.1" |
| 245 |
username: "username" |
| 246 |
password: "password" |
| 247 |
ca_path: "/path/to/ca_cert.pem" |
| 248 |
command: delete |
| 249 |
names: |
| 250 |
- baseline1 |
| 251 |
- baseline2 |
| 252 |
|
| 253 |
- name: Modify a configuration compliance baseline using group names |
| 254 |
dellemc.openmanage.ome_configuration_compliance_baseline: |
| 255 |
hostname: "192.168.0.1" |
| 256 |
username: "username" |
| 257 |
password: "password" |
| 258 |
ca_path: "/path/to/ca_cert.pem" |
| 259 |
command: modify |
| 260 |
names: "baseline1" |
| 261 |
new_name: "baseline_update" |
| 262 |
template_name: "template2" |
| 263 |
description: "new description of baseline" |
| 264 |
job_wait_timeout: 1000 |
| 265 |
device_group_names: |
| 266 |
- Group1 |
| 267 |
|
| 268 |
- name: Remediate specific non-compliant devices to a configuration compliance baseline using device IDs |
| 269 |
dellemc.openmanage.ome_configuration_compliance_baseline: |
| 270 |
hostname: "192.168.0.1" |
| 271 |
username: "username" |
| 272 |
password: "password" |
| 273 |
ca_path: "/path/to/ca_cert.pem" |
| 274 |
command: "remediate" |
| 275 |
names: "baseline1" |
| 276 |
device_ids: |
| 277 |
- 1111 |
| 278 |
|
| 279 |
- name: Remediate specific non-compliant devices to a configuration compliance baseline using device service tags |
| 280 |
dellemc.openmanage.ome_configuration_compliance_baseline: |
| 281 |
hostname: "192.168.0.1" |
| 282 |
username: "username" |
| 283 |
password: "password" |
| 284 |
ca_path: "/path/to/ca_cert.pem" |
| 285 |
command: "remediate" |
| 286 |
names: "baseline1" |
| 287 |
device_service_tags: |
| 288 |
- "SVCTAG1" |
| 289 |
- "SVCTAG2" |
| 290 |
|
| 291 |
- name: Remediate all the non-compliant devices to a configuration compliance baseline |
| 292 |
dellemc.openmanage.ome_configuration_compliance_baseline: |
| 293 |
hostname: "192.168.0.1" |
| 294 |
username: "username" |
| 295 |
password: "password" |
| 296 |
ca_path: "/path/to/ca_cert.pem" |
| 297 |
command: "remediate" |
| 298 |
names: "baseline1" |
| 299 |
|
| 300 |
- name: Remediate specific non-compliant devices to a configuration compliance baseline using device IDs at scheduled time |
| 301 |
dellemc.openmanage.ome_configuration_compliance_baseline: |
| 302 |
hostname: "192.168.0.1" |
| 303 |
username: "username" |
| 304 |
password: "password" |
| 305 |
ca_path: "/path/to/ca_cert.pem" |
| 306 |
command: "remediate" |
| 307 |
names: "baseline1" |
| 308 |
device_ids: |
| 309 |
- 1111 |
| 310 |
run_later: true |
| 311 |
cron: "0 10 11 14 02 ? 2032" # Feb 14,2032 11:10:00 |
| 312 |
|
| 313 |
- name: Remediate specific non-compliant devices to a configuration compliance baseline using device service tags on next reboot |
| 314 |
dellemc.openmanage.ome_configuration_compliance_baseline: |
| 315 |
hostname: "192.168.0.1" |
| 316 |
username: "username" |
| 317 |
password: "password" |
| 318 |
ca_path: "/path/to/ca_cert.pem" |
| 319 |
command: "remediate" |
| 320 |
names: "baseline1" |
| 321 |
device_service_tags: |
| 322 |
- "SVCTAG1" |
| 323 |
- "SVCTAG2" |
| 324 |
staged_at_reboot: true |
| 325 |
|
| 326 |
|
| 327 |
|
| 328 |
Return Values |
| 329 |
------------- |
| 330 |
|
| 331 |
msg (always, str, Successfully created the configuration compliance baseline.) |
| 332 |
Overall status of the configuration compliance baseline operation. |
| 333 |
|
| 334 |
|
| 335 |
incompatible_devices (when I(device_service_tags) or I(device_ids) contains incompatible devices for C(create) or C(modify), list, [1234, 5678]) |
| 336 |
Details of the devices which cannot be used to perform baseline compliance operations |
| 337 |
|
| 338 |
|
| 339 |
compliance_status (when I(command) is C(create) or C(modify), dict, {'Id': 13, 'Name': 'baseline1', 'Description': None, 'TemplateId': 102, 'TemplateName': 'one', 'TemplateType': 2, 'TaskId': 26584, 'PercentageComplete': '100', 'TaskStatus': 2070, 'LastRun': '2021-02-27 13:15:13.751', 'BaselineTargets': [{'Id': 1111, 'Type': {'Id': 1000, 'Name': 'DEVICE'}}], 'ConfigComplianceSummary': {'ComplianceStatus': 'OK', 'NumberOfCritical': 0, 'NumberOfWarning': 0, 'NumberOfNormal': 0, 'NumberOfIncomplete': 0}}) |
| 340 |
Status of compliance baseline operation. |
| 341 |
|
| 342 |
|
| 343 |
job_id (when I(command) is C(remediate), int, 14123) |
| 344 |
Task ID created when \ :emphasis:`command`\ is \ :literal:`remediate`\ . |
| 345 |
|
| 346 |
|
| 347 |
job_details (on job failure, list, [{'ElapsedTime': '00:22:17', 'EndTime': '2024-06-19 13:42:41.285', 'ExecutionHistoryId': 797320, 'Id': 14123, 'IdBaseEntity': 19559, 'JobStatus': {'Id': 2070, 'Name': 'Failed'}, 'Key': 'SVCTAG1', 'Progress': '100', 'StartTime': '2024-06-19 13:20:23.495', 'Value': 'Starting Pre-checks....LC status is : InUse, wait for 30 seconds and retry ...(1)'}]) |
| 348 |
Details of the failed job. |
| 349 |
|
| 350 |
|
| 351 |
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': 'GEN1234', 'RelatedProperties': [], 'Message': 'Unable to process the request because an error occurred.', 'MessageArgs': [], 'Severity': 'Critical', 'Resolution': 'Retry the operation. If the issue persists, contact your system administrator.'}]}}) |
| 352 |
Details of the HTTP Error. |
| 353 |
|
| 354 |
|
| 355 |
|
| 356 |
|
| 357 |
|
| 358 |
Status |
| 359 |
------ |
| 360 |
|
| 361 |
|
| 362 |
|
| 363 |
|
| 364 |
|
| 365 |
Authors |
| 366 |
~~~~~~~ |
| 367 |
|
| 368 |
- Sajna Shetty(@Sajna-Shetty) |
| 369 |
- Abhishek Sinha(@Abhishek-Dell) |
| 370 |
- Shivam Sharma(@ShivamSh3) |
| 371 |
- Meenakshi Dembi(@meenakshidembi691) |