IBM-Security / isam-ansible-roles

Ansible Custom Modules, Handlers and Tasks for ISAM. Requires "ibmsecurity" python package.
Apache License 2.0
24 stars 43 forks source link

cert kdb cleanup fails to list kdb to resolve failures #167

Open rfransix opened 4 years ago

rfransix commented 4 years ago

Hi, i'm using the following to loop through the cert kdb's and delete expired certs, however, on failure the play exits without displaying the current kdb id name. How do i code to output the kdb id on every query so i know where to focus troubleshooting? Thank you.

I can output the kdb id names on "Get All Cert KDB Names", yet when it 'changes', 'skips', or on 'failure' the output does not include the id kdb name. Here is an example error:

TASK [delete_certdb_personal_cert_cg : Get list of Personal Certificates in Keystore] *** fatal: [hostname.com]: FAILED! => {"changed": false, "log": "[2019-11-25 13:43:51,195] [PID:9329 TID:140155918956352] [DEBUG] [ibmsecurity.appliance.ibmappliance] [_process_response():80] Text: {\"firmware_label\":\"isam_9.0.4.0_20171201-2325\",\"firmware_build\":\"20171201-2325\",\"firmware_version\":\"9.0.4.0\",\"product_description\":\"IBM Security Access Manager\",\"deployment_model\":\"Appliance\",\"product_name\":\"isam\"}\n[2019-11-25 13:43:51,320] [PID:9329 TID:140155918956352] [DEBUG] [ibmsecurity.appliance.ibmappliance] [_process_response():80] Text: { \"configured\": true}\n[2019-11-25 13:43:51,454] [PID:9329 TID:140155918956352] [DEBUG] [ibmsecurity.appliance.ibmappliance] [_process_response():80] Text: [{\"name\":\"ISAM Base Appliance\",\"description\":\"IBM Security Access Manager Base Appliance\",\"id\":\"wga\",\"enabled\":\"True\"}, {\"name\":\"ISAM Advanced Access Control\",\"description\":\"IBM Security Access Manager Advanced Access Control\",\"id\":\"mga\",\"enabled\":\"True\"}, {\"name\":\"ISAM Federation\",\"description\":\"IBM Security Access Manager Federation\",\"id\":\"federation\",\"enabled\":\"True\"}]\n[2019-11-25 13:43:52,112] [PID:9329 TID:140155918956352] [ERROR] [ibmsecurity.appliance.ibmappliance] [_process_response():64] text: {\"message\":\"DPWAP0039E An error occured in the GSKKM_OpenKeyDbX(&dbInfo, &dbh) system function: GSKKM_ERR_NULL_PARAMETER\"}\n", "msg": "('HTTP Return code: 500', u'{\"message\":\"DPWAP0039E An error occured in the GSKKM_OpenKeyDbX(&dbInfo, &dbh) system function: GSKKM_ERR_NULL_PARAMETER\"}')", "name": "ibmsecurity.isam.base.ssl_certificates.personal_certificate.get_all"}


Create a Report on Junctions

###########################################################################################################

Set the timestamp variable to be used in create snapshot comment

###########################################################################################################

###########################################################################################################

Set the timestamp variable to be used in create snapshot comment

###########################################################################################################

###########################################################################################################

Get a list of the certificate databases from the primary appliance.

###########################################################################################################

###########################################################################################################

Check to see if personal certificates in KDB are expired and delete if expired.

###########################################################################################################

###########################################################################################################

Check to see if signer certificates in KDB are expired and delete if expired.

###########################################################################################################


here is the get_cert_dbs_cg

ram-ibm commented 4 years ago

I suspect using ignore_errors flag in the task that is failing should let me proceed to the "Output" task?

ram-ibm commented 4 years ago
block:
rescue:
always:

https://docs.ansible.com/ansible/latest/user_guide/playbooks_blocks.html The above might be better solution to handling errors?