summaryrefslogtreecommitdiff
path: root/roles/monitoring/prometheus/ca
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2021-06-06 14:57:25 +0200
committerChristian Pointner <equinox@spreadspace.org>2021-06-20 01:44:16 +0200
commit8ab24a10ac669ade61761d37e68207b402bc277c (patch)
tree61572076d0789086f38c72cd0f33eaa2a985e4a7 /roles/monitoring/prometheus/ca
parentprometheus: fix blackbox exporter icmp probes (diff)
prometheus: move CA to seperate role and add prometheus zone groups
Diffstat (limited to 'roles/monitoring/prometheus/ca')
-rw-r--r--roles/monitoring/prometheus/ca/tasks/main.yml52
1 files changed, 52 insertions, 0 deletions
diff --git a/roles/monitoring/prometheus/ca/tasks/main.yml b/roles/monitoring/prometheus/ca/tasks/main.yml
new file mode 100644
index 00000000..9f166321
--- /dev/null
+++ b/roles/monitoring/prometheus/ca/tasks/main.yml
@@ -0,0 +1,52 @@
+---
+- name: install python-cryptoraphy
+ apt:
+ name: "{{ python_basename }}-cryptography"
+ state: present
+
+- name: create base directory
+ file:
+ path: /etc/ssl/prometheus
+ state: directory
+
+- name: create CA directory
+ file:
+ path: /etc/ssl/prometheus/ca
+ state: directory
+ owner: root
+ group: root
+ mode: 0700
+
+- name: create CA private key
+ openssl_privatekey:
+ path: /etc/ssl/prometheus/ca/key.pem
+ type: RSA
+ size: 4096
+ owner: root
+ group: root
+ mode: 0600
+
+- name: create signing request for CA certificate
+ openssl_csr:
+ path: /etc/ssl/prometheus/ca/csr.pem
+ privatekey_path: /etc/ssl/prometheus/ca/key.pem
+ CN: "CA for promethues zone {{ promethues_zone_name }}"
+ useCommonNameForSAN: no
+ key_usage:
+ - cRLSign
+ - digitalSignature
+ - keyCertSign
+ key_usage_critical: yes
+ basic_constraints:
+ - 'CA:TRUE'
+ - 'pathlen:0'
+ basic_constraints_critical: yes
+
+- name: create self-signed CA certificate
+ openssl_certificate:
+ path: /etc/ssl/prometheus/ca-crt.pem
+ csr_path: /etc/ssl/prometheus/ca/csr.pem
+ privatekey_path: /etc/ssl/prometheus/ca/key.pem
+ provider: selfsigned
+ selfsigned_digest: sha256
+ selfsigned_not_after: "+18250d" ## 50 years