blob: 8c02e70a0853e0c4cbad334648bcb2e8de84fc79 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
hosts: localhost
parallelism: false
tasks:
- name: Generar certificado autofirmado en /tmp
module: run
args:
command: |
openssl req -x509 -newkey rsa:2048 -keyout /tmp/test.key -out /tmp/test.crt \
-days 365 -nodes -subj "/CN=example.com" && \
openssl pkcs12 -export -out /tmp/certificado.pfx \
-inkey /tmp/test.key -in /tmp/test.crt \
-name "Certificado de Prueba" -password pass:secreta
become: false
- name: Convertir PFX a PEM
module: openssl
args:
state: convert
src: /tmp/certificado.pfx
dest: /tmp/certificado.pem
format: pem
password: "secreta"
- name: Inspeccionar certificado convertido
module: openssl
args:
state: inspect
src: /tmp/certificado.pem
- name: Instalar certificado como CA confiable
module: openssl
args:
state: trust
src: /tmp/certificado.pem
alias: mi_certificado
trust_path: /usr/local/share/ca-certificates/
become: true
- name: Eliminar certificado como CA
module: openssl
args:
state: untrust
alias: mi_certificado
trust_path: /usr/local/share/ca-certificates/
become: true
|