Does anyone have sample code on how to pull from Vault, the raw cert of an existing CN (cert common name)?
Hoping for curl command examples that can eventually turn into ansible code.
Current ansible code shown below seems to create a new cert by (a) logging in w/ temp token and (b) providing only common_name and cert_ttl.
- name: Get certificate json
uri:
url:“{{vault_url}}{{vault_pki_path}}”
headers:
X-Vault-Token:“{{json_token_from_services_role}} <<< loginto vault w/ temp token
body_format:json
method:POST
body:
common_name:”{{cert_common_name}}
ttl:"{{cert_ttl}}
register:vault_cert_raw <<< output from vault gets put here
From above code, the info returned looks like certificate, private_key and issuing_ca. These get passed to another ansible yml script.
Am trying to do something similar, but to only extract the info of existing cert, instead of creating a totally new certificate.
Appreciate any advice, guidance and or observations.