Reputation: 29
As per of our application setup I have to convert .p12 files to password protected tlskeyStore file. I am trying to achieve this using ansible module community.general.java_cert..
- name: Import P12 Cert to KeyStore
community.general.java_cert:
pkcs12_path: "{{ p12_file_path }}/{{inventory_hostname}}.p12" ## 2 hosts are there
pkcs12_alias: test
pkcs12_password: "{{ pwd }}"
cert_alias: "[{{ item }}] cert_alias: {{ item }}" ## add numbers for each alias
keystore_path: "{{ path }}/tlsKeyStore"
keystore_type: "JKS"
keystore_pass: "{{ pwd }}"
keystore_create: "{{ tls_key_trust_store }}"
with_sequence: start=1 end="{{ groups[nxos] | length }}" ## this group has 2 hosts
run_once: true
args:
executable: "{{ path }}/jre/bin/keytool"
but I am getting below error
{"ansible_loop_var": "item", "changed": false, "item": "1", "msg": "Internal module failure, cannot extract public certificate from PKCS12, message: keytool error: java.io.IOException: parseAlgParameters failed: ObjectIdentifier() -- data isn't an object ID (tag = 48)\n", "rc": 1, "stderr": "Enter keystore password: ", "stderr_lines": ["Enter keystore password: "]}
The error in the above output is to be precise
data isn't an object ID (tag = 48)
I tried to manually import the file into the keystore which is working fine. I used the same parameters as in the ansible module
keytool -importkeystore -srckeystore sw2-ndb.p12 -srcstoretype pkcs12 -destkeystore tlsKeyStore -deststoretype jks
Could someone throw some light whether there is something wrong in my ansible syntax?
Upvotes: 0
Views: 44