| 1 | # idrac_certificate |
| 2 | |
| 3 | Role to manage the iDRAC certificates - Generate Certificate Signing Request, Import/Export certificates, and Reset configuration - for PowerEdge servers. |
| 4 | |
| 5 | ## Requirements |
| 6 | |
| 7 | --- |
| 8 | |
| 9 | Requirements to develop and contribute to the role. |
| 10 | |
| 11 | ### Development |
| 12 | |
| 13 | ``` |
| 14 | ansible |
| 15 | docker |
| 16 | molecule |
| 17 | python |
| 18 | ``` |
| 19 | |
| 20 | ### Production |
| 21 | |
| 22 | Requirements to use the role. |
| 23 | |
| 24 | ``` |
| 25 | ansible |
| 26 | python |
| 27 | ``` |
| 28 | |
| 29 | ## Ansible collections |
| 30 | |
| 31 | Collections required to use the role. |
| 32 | |
| 33 | ``` |
| 34 | dellemc.openmanage |
| 35 | ``` |
| 36 | |
| 37 | ## Role Variables |
| 38 | |
| 39 | --- |
| 40 | |
| 41 | <table> |
| 42 | <thead> |
| 43 | <tr> |
| 44 | <th>Name</th> |
| 45 | <th>Required</th> |
| 46 | <th>Default Value</th> |
| 47 | <th>Choices</th> |
| 48 | <th>Type</th> |
| 49 | <th>Description</th> |
| 50 | </tr> |
| 51 | </thead> |
| 52 | <tbody> |
| 53 | <tr> |
| 54 | <td>hostname</td> |
| 55 | <td>true</td> |
| 56 | <td></td> |
| 57 | <td></td> |
| 58 | <td>str</td> |
| 59 | <td>- iDRAC IP Address</td> |
| 60 | </tr> |
| 61 | <tr> |
| 62 | <td>username</td> |
| 63 | <td>true</td> |
| 64 | <td></td> |
| 65 | <td></td> |
| 66 | <td>str</td> |
| 67 | <td>- iDRAC username</td> |
| 68 | </tr> |
| 69 | <tr> |
| 70 | <td>password</td> |
| 71 | <td>true</td> |
| 72 | <td></td> |
| 73 | <td></td> |
| 74 | <td>str</td> |
| 75 | <td>- iDRAC user password.</td> |
| 76 | </tr> |
| 77 | <tr> |
| 78 | <td>https_port</td> |
| 79 | <td>false</td> |
| 80 | <td>443</td> |
| 81 | <td></td> |
| 82 | <td>int</td> |
| 83 | <td>- iDRAC port.</td> |
| 84 | </tr> |
| 85 | <tr> |
| 86 | <td>validate_certs</td> |
| 87 | <td>false</td> |
| 88 | <td>true</td> |
| 89 | <td></td> |
| 90 | <td>bool</td> |
| 91 | <td>- If C(false), the SSL certificates will not be validated.<br>- Configure C(false) only on personally controlled sites where self-signed certificates are used.</td> |
| 92 | </tr> |
| 93 | <tr> |
| 94 | <td>ca_path</td> |
| 95 | <td>false</td> |
| 96 | <td></td> |
| 97 | <td></td> |
| 98 | <td>path</td> |
| 99 | <td>- The Privacy Enhanced Mail (PEM) file that contains a CA certificate to be used for the validation.</td> |
| 100 | </tr> |
| 101 | <tr> |
| 102 | <td>https_timeout</td> |
| 103 | <td>false</td> |
| 104 | <td>30</td> |
| 105 | <td></td> |
| 106 | <td>int</td> |
| 107 | <td>- The socket level timeout in seconds.</td> |
| 108 | </tr> |
| 109 | <tr> |
| 110 | <td>command</td> |
| 111 | <td>false</td> |
| 112 | <td>generate_csr</td> |
| 113 | <td>'import', 'export', 'generate_csr', 'reset'</td> |
| 114 | <td>str</td> |
| 115 | <td>- C(generate_csr), generate CSR. This requires I(cert_params) and I(certificate_path). |
| 116 | <br>- C(import), import the certificate file. This requires I(certificate_path). |
| 117 | <br>- C(export), export the certificate. This requires I(certificate_path). |
| 118 | <br>- C(reset), reset the certificate to default settings. This is applicable only for C(HTTPS). |
| 119 | </td> |
| 120 | </tr> |
| 121 | <tr> |
| 122 | <td>certificate_type</td> |
| 123 | <td>false</td> |
| 124 | <td>HTTPS</td> |
| 125 | <td>'HTTPS', 'CA', 'CSC', 'CLIENT_TRUST_CERTIFICATE', 'CUSTOMCERTIFICATE'</td> |
| 126 | <td>str</td> |
| 127 | <td>-Type of the iDRAC certificate: |
| 128 | <br>- C(HTTPS) The Dell self-signed SSL certificate. |
| 129 | <br>- C(CA) Certificate Authority(CA) signed SSL certificate. |
| 130 | <br>- C(CSC) The custom signed SSL certificate. |
| 131 | <br>- C(CLIENT_TRUST_CERTIFICATE) Client trust certificate. |
| 132 | <br>- C(CUSTOMCERTIFICATE) The custom PKCS12 certificate and private key. Export of custom certificate is supported only on iDRAC firmware version 7.00.00.00 and above.</td> |
| 133 | </tr> |
| 134 | <tr> |
| 135 | <td>certificate_path</td> |
| 136 | <td>false</td> |
| 137 | <td></td> |
| 138 | <td></td> |
| 139 | <td>path</td> |
| 140 | <td>- Absolute path of the certificate file if I(command) is C(import). |
| 141 | <br>- Directory path with write permissions if I(command) is C(generate_csr) or C(export).<br></td> |
| 142 | </tr> |
| 143 | <tr> |
| 144 | <td>passpharse</td> |
| 145 | <td>false</td> |
| 146 | <td></td> |
| 147 | <td></td> |
| 148 | <td>str</td> |
| 149 | <td>- The passphrase string if the certificate to be imported is passphrase protected.</td> |
| 150 | </tr> |
| 151 | <tr> |
| 152 | <td>ssl_key</td> |
| 153 | <td>false</td> |
| 154 | <td></td> |
| 155 | <td></td> |
| 156 | <td>path</td> |
| 157 | <td>- Absolute path of the private or SSL key file. |
| 158 | <br>- This is applicable only when I(command) is C(import) and I(certificate_type) is C(HTTPS). |
| 159 | <br>- Uploading the SSL key on iDRAC is supported on version 6.00.02.00 and newer versions.<br></td> |
| 160 | </tr> |
| 161 | <tr> |
| 162 | <td>cert_params</td> |
| 163 | <td>false</td> |
| 164 | <td></td> |
| 165 | <td></td> |
| 166 | <td>dict</td> |
| 167 | <td></td> |
| 168 | </tr> |
| 169 | <tr> |
| 170 | <td> common_name</td> |
| 171 | <td>false</td> |
| 172 | <td></td> |
| 173 | <td></td> |
| 174 | <td>str</td> |
| 175 | <td>- The common name of the certificate.</td> |
| 176 | </tr> |
| 177 | <tr> |
| 178 | <td> organization_unit</td> |
| 179 | <td>false</td> |
| 180 | <td>true</td> |
| 181 | <td></td> |
| 182 | <td>str</td> |
| 183 | <td>- The name associated with an organizational unit. For example, department name.</td> |
| 184 | </tr> |
| 185 | <tr> |
| 186 | <td> locality_name</td> |
| 187 | <td>false</td> |
| 188 | <td></td> |
| 189 | <td></td> |
| 190 | <td>str</td> |
| 191 | <td>- The city or other location where the entity applying for certification is located.</td> |
| 192 | </tr> |
| 193 | <tr> |
| 194 | <td> state_name</td> |
| 195 | <td>false</td> |
| 196 | <td></td> |
| 197 | <td></td> |
| 198 | <td>str</td> |
| 199 | <td>- The state where the entity applying for certification is located.</td> |
| 200 | </tr> |
| 201 | <tr> |
| 202 | <td> country_code</td> |
| 203 | <td>false</td> |
| 204 | <td></td> |
| 205 | <td></td> |
| 206 | <td>str</td> |
| 207 | <td> - The country code of the country where the entity applying for certification is located.</td> |
| 208 | </tr> |
| 209 | <tr> |
| 210 | <td> email_address</td> |
| 211 | <td>false</td> |
| 212 | <td></td> |
| 213 | <td></td> |
| 214 | <td>str</td> |
| 215 | <td>- The email associated with the CSR.</td> |
| 216 | </tr> |
| 217 | <tr> |
| 218 | <td> organization_name</td> |
| 219 | <td>false</td> |
| 220 | <td></td> |
| 221 | <td></td> |
| 222 | <td>str</td> |
| 223 | <td>- The name associated with an organization.</td> |
| 224 | </tr> |
| 225 | <tr> |
| 226 | <td> subject_alt_name</td> |
| 227 | <td>false</td> |
| 228 | <td>[]</td> |
| 229 | <td></td> |
| 230 | <td>list</td> |
| 231 | <td>- The alternative domain names associated with the request.</td> |
| 232 | </tr> |
| 233 | <tr> |
| 234 | <td>resource_id</td> |
| 235 | <td>false</td> |
| 236 | <td></td> |
| 237 | <td></td> |
| 238 | <td>str</td> |
| 239 | <td>- Redfish ID of the resource.</td> |
| 240 | </tr> |
| 241 | <tr> |
| 242 | <td>reset</td> |
| 243 | <td>false</td> |
| 244 | <td>true</td> |
| 245 | <td></td> |
| 246 | <td>bool</td> |
| 247 | <td>- To reset the iDRAC after the certificate operation.<br>- This is applicable when I(command) is C(import) or C(reset).<br></td> |
| 248 | </tr> |
| 249 | <tr> |
| 250 | <td>wait</td> |
| 251 | <td>false</td> |
| 252 | <td>300</td> |
| 253 | <td></td> |
| 254 | <td>bool</td> |
| 255 | <td>- Maximum wait time for iDRAC to start after the reset, in seconds.<br>- This is applicable when I(command) is C(import) or C(reset) and I(reset) is C(True).<br></td> |
| 256 | </tr> |
| 257 | </tbody> |
| 258 | </table> |
| 259 | |
| 260 | ## Fact variables |
| 261 | |
| 262 | <table> |
| 263 | <thead> |
| 264 | <tr> |
| 265 | <th>Name</th> |
| 266 | <th>Sample</th> |
| 267 | <th>Description</th> |
| 268 | </tr> |
| 269 | </thead> |
| 270 | <tbody> |
| 271 | <tr> |
| 272 | <td>idrac_certificate_out</td> |
| 273 | <td>{ |
| 274 | "certificate_path": "/root/Certs/192.168.0.1_202333_4130_HTTPS.pem", |
| 275 | "changed": false, |
| 276 | "msg": "Successfully performed the 'export' operation." |
| 277 | }</td> |
| 278 | <td>Module output of the cerificate export job.</td> |
| 279 | </tr> |
| 280 | </tbody> |
| 281 | </table> |
| 282 | |
| 283 | ## Examples |
| 284 | |
| 285 | --- |
| 286 | |
| 287 | ``` |
| 288 | - name: Generate HTTPS certificate signing request |
| 289 | ansible.builtin.import_role: |
| 290 | name: idrac_certificate |
| 291 | vars: |
| 292 | hostname: "192.168.0.1" |
| 293 | username: "user_name" |
| 294 | password: "user_password" |
| 295 | ca_path: "/path/to/ca_cert.pem" |
| 296 | command: "generate_csr" |
| 297 | certificate_type: "HTTPS" |
| 298 | certificate_path: "/home/omam/mycerts" |
| 299 | cert_params: |
| 300 | common_name: "sample.domain.com" |
| 301 | organization_unit: "OrgUnit" |
| 302 | locality_name: "Bangalore" |
| 303 | state_name: "Karnataka" |
| 304 | country_code: "IN" |
| 305 | email_address: "[email protected]" |
| 306 | organization_name: "OrgName" |
| 307 | subject_alt_name: |
| 308 | - 192.198.2.1 |
| 309 | ``` |
| 310 | |
| 311 | ``` |
| 312 | - name: Importing certificate. |
| 313 | ansible.builtin.import_role: |
| 314 | name: idrac_certificate |
| 315 | vars: |
| 316 | hostname: "192.168.0.1" |
| 317 | username: "user_name" |
| 318 | password: "user_password" |
| 319 | ca_path: "/path/to/ca_cert.pem" |
| 320 | command: "import" |
| 321 | certificate_type: "HTTPS" |
| 322 | certificate_path: "/path/to/cert.pem" |
| 323 | ``` |
| 324 | |
| 325 | ``` |
| 326 | - name: Exporting certificate. |
| 327 | ansible.builtin.import_role: |
| 328 | name: idrac_certificate |
| 329 | vars: |
| 330 | hostname: "192.168.0.1" |
| 331 | username: "user_name" |
| 332 | password: "user_password" |
| 333 | ca_path: "/path/to/ca_cert.pem" |
| 334 | command: "export" |
| 335 | certificate_type: "HTTPS" |
| 336 | certificate_path: "/home/omam/mycert_dir" |
| 337 | ``` |
| 338 | |
| 339 | ``` |
| 340 | - name: Importing Custom Signing Certificate. |
| 341 | ansible.builtin.import_role: |
| 342 | name: idrac_certificate |
| 343 | vars: |
| 344 | hostname: "192.168.0.1" |
| 345 | username: "user_name" |
| 346 | password: "user_password" |
| 347 | ca_path: "/path/to/ca_cert.pem" |
| 348 | command: "import" |
| 349 | certificate_type: "CSC" |
| 350 | certificate_path: "/path/to/cert.pem" |
| 351 | ``` |
| 352 | |
| 353 | ``` |
| 354 | - name: Import an HTTPS certificate with private key. |
| 355 | ansible.builtin.import_role: |
| 356 | name: idrac_certificate |
| 357 | vars: |
| 358 | hostname: "192.168.0.1" |
| 359 | username: "user_name" |
| 360 | password: "user_password" |
| 361 | ca_path: "/path/to/ca_cert.pem" |
| 362 | command: "import" |
| 363 | certificate_type: "HTTPS" |
| 364 | certificate_path: "/path/to/cert.pem" |
| 365 | ssl_key: "/path/to/ssl_key" |
| 366 | ``` |
| 367 | |
| 368 | ``` |
| 369 | - name: Exporting certificate. |
| 370 | ansible.builtin.import_role: |
| 371 | name: idrac_certificate |
| 372 | vars: |
| 373 | hostname: "192.168.0.1" |
| 374 | username: "user_name" |
| 375 | password: "user_password" |
| 376 | ca_path: "/path/to/ca_cert.pem" |
| 377 | command: "export" |
| 378 | certificate_type: "CLIENT_TRUST_CERTIFICATE" |
| 379 | certificate_path: "/home/omam/mycert_dir" |
| 380 | ``` |
| 381 | |
| 382 | ## Author Information |
| 383 | --- |
| 384 | Dell Technologies <br> |
| 385 | Shivam Sharma ([email protected]) 2023<br> |
| 386 | Jagadeesh N V ([email protected]) 2023 |