Instantly share code, notes, and snippets.

Embed
What would you like to do?
A simple ansible playbook to create a new self-signed certificate
---
- hosts: localhost
vars:
- dnsname: your.dns.name
- tmppath: "./tmp/"
- crtpath: "{{ tmppath }}{{ dnsname }}.crt"
- pempath: "{{ tmppath }}{{ dnsname }}.pem"
- csrpath: "{{ tmppath }}{{ dnsname }}.csr"
- pfxpath: "{{ tmppath }}{{ dnsname }}.pfx"
tasks:
- file:
path: "{{ tmppath }}"
state: absent
- file:
path: "{{ tmppath }}"
state: directory
- openssl_privatekey:
path: "{{ pempath }}"
passphrase: password
cipher: aes256
- openssl_csr:
path: "{{ csrpath }}"
privatekey_path: "{{ pempath }}"
privatekey_passphrase: password
common_name: "{{ dnsname }}"
- openssl_certificate:
path: "{{ crtpath }}"
privatekey_path: "{{ pempath }}"
privatekey_passphrase: password
csr_path: "{{ csrpath }}"
provider: selfsigned
- openssl_pkcs12:
action: export
path: "{{ pfxpath }}"
name: "{{ dnsname }}"
privatekey_path: "{{ pempath }}"
privatekey_passphrase: password
passphrase: password
certificate_path: "{{ crtpath }}"
state: present
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment