2020-09-19 21:39:57 +02:00
|
|
|
---
|
2020-09-20 00:12:35 +02:00
|
|
|
- name: Generate a private key for root CA
|
2020-09-19 21:39:57 +02:00
|
|
|
become: true
|
|
|
|
openssl_privatekey:
|
2020-09-20 00:12:35 +02:00
|
|
|
path: "/etc/ssl/private/{{ root_ca.slug }}.pem"
|
2020-09-19 21:39:57 +02:00
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: u=r,g=,o=
|
|
|
|
type: ECC
|
|
|
|
curve: secp384r1
|
|
|
|
|
|
|
|
- name: Generate a CSR for the root CA private key
|
|
|
|
become: true
|
|
|
|
openssl_csr:
|
2020-09-20 00:12:35 +02:00
|
|
|
privatekey_path: "/etc/ssl/private/{{ root_ca.slug }}.pem"
|
|
|
|
path: "/etc/ssl/csr/{{ root_ca.slug }}.csr"
|
2020-09-19 21:39:57 +02:00
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: u=r,g=,o=
|
2020-09-20 00:12:35 +02:00
|
|
|
common_name: "{{ root_ca.common_name }}"
|
|
|
|
country_name: "{{ root_ca.country_name }}"
|
|
|
|
locality_name: "{{ root_ca.locality_name }}"
|
|
|
|
organization_name: "{{ root_ca.organization_name }}"
|
|
|
|
state_or_province_name: "{{ root_ca.state_name }}"
|
|
|
|
email_address: "{{ root_ca.email }}"
|
2020-09-19 21:39:57 +02:00
|
|
|
use_common_name_for_san: false
|
|
|
|
basic_constraints_critical: true
|
|
|
|
basic_constraints:
|
|
|
|
- CA:TRUE
|
2020-09-20 00:12:35 +02:00
|
|
|
- pathlen:0 # FIXME: sub CA personnes ?
|
2020-09-19 21:39:57 +02:00
|
|
|
key_usage:
|
|
|
|
- keyCertSign
|
|
|
|
- cRLSign
|
|
|
|
key_usage_critical: true
|
|
|
|
|
2020-09-20 00:12:35 +02:00
|
|
|
# FIXME: regénérer quand le certificat est expiré (ne semble pas
|
|
|
|
# le cas actuellement)
|
2020-09-19 21:39:57 +02:00
|
|
|
- name: Generate the root CA certificate
|
|
|
|
become: true
|
|
|
|
openssl_certificate:
|
2020-09-20 00:12:35 +02:00
|
|
|
privatekey_path: "/etc/ssl/private/{{ root_ca.slug }}.pem"
|
|
|
|
csr_path: "/etc/ssl/csr/{{ root_ca.slug }}.csr"
|
|
|
|
path: "/etc/ssl/certs/{{ root_ca.slug }}.pem"
|
2020-09-19 21:39:57 +02:00
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: u=r,g=r,o=r
|
|
|
|
provider: selfsigned
|
2020-09-20 00:12:35 +02:00
|
|
|
selfsigned_not_before: "{{ root_ca.not_before }}"
|
|
|
|
selfsigned_not_after: "{{ root_ca.not_after }}"
|
2020-09-19 21:39:57 +02:00
|
|
|
|
|
|
|
- name: Retrieve the root CA certificate
|
|
|
|
fetch:
|
2020-09-20 00:12:35 +02:00
|
|
|
src: "/etc/ssl/certs/{{ root_ca.slug }}.pem"
|
|
|
|
dest: "loot/certs/{{ root_ca.slug }}.pem"
|
2020-09-19 21:39:57 +02:00
|
|
|
flat: yes
|
|
|
|
...
|