generate self signed certificate

This commit is contained in:
Jean-Marie Mineau 2021-01-26 19:36:59 +01:00
parent f5ab92a99e
commit f5acec43ec
4 changed files with 32 additions and 0 deletions

View file

@ -0,0 +1,3 @@
---
country_name: FR
organization_name: Pains-Perdus

1
hosts
View file

@ -27,6 +27,7 @@ all:
keycloak_host:
hosts:
vb2:
server_hostname: 10.0.2.9
gitea_host:
hosts:
vb1:

View file

@ -4,4 +4,5 @@
- hosts: keycloak_host
roles:
- install_docker
- generate_self_signed_certificate
- install_keycloak

View file

@ -0,0 +1,27 @@
---
- name: Ensure the cert directory exists
file:
path: /var/certificates
state: directory
- name: Generate an OpenSSL private key
openssl_privatekey:
path: "/var/certificates/{{ server_hostname }}_privkey.pem"
size: 4096
type: RSA
- name: Generate an OpenSSL Certificate Signing Request with Subject information
openssl_csr:
path: "/var/certificates/{{ server_hostname }}.csr"
privatekey_path: "/var/certificates/{{ server_hostname }}_privkey.pem"
country_name: "{{ country_name }}"
organization_name: "{{ organization_name }}"
email_address: "{{ vault_email }}"
common_name: "{{ server_hostname }}"
- name: Generate a Self Signed OpenSSL certificate
openssl_certificate:
path: "/var/certificates/{{ server_hostname }}_cert.pem"
privatekey_path: "/var/certificates/{{ server_hostname }}_privkey.pem"
csr_path: "/var/certificates/{{ server_hostname }}.csr"
provider: selfsigned