|
@@ -3,50 +3,41 @@
|
|
|
command: >
|
|
|
{{ openshift.common.admin_binary }} ca create-server-cert
|
|
|
--config={{ mktemp.stdout }}/admin.kubeconfig
|
|
|
- --key='{{ openshift_metrics_certs_dir }}/{{ component }}.key'
|
|
|
- --cert='{{ openshift_metrics_certs_dir }}/{{ component }}.crt'
|
|
|
+ --key='{{ mktemp.stdout }}/{{ component }}.key'
|
|
|
+ --cert='{{ mktemp.stdout }}/{{ component }}.crt'
|
|
|
--hostnames='{{ hostnames }}'
|
|
|
- --signer-cert='{{ openshift_metrics_certs_dir }}/ca.crt'
|
|
|
- --signer-key='{{ openshift_metrics_certs_dir }}/ca.key'
|
|
|
- --signer-serial='{{ openshift_metrics_certs_dir }}/ca.serial.txt'
|
|
|
- when: not '{{ openshift_metrics_certs_dir }}/{{ component }}.key'|exists
|
|
|
+ --signer-cert='{{ mktemp.stdout }}/ca.crt'
|
|
|
+ --signer-key='{{ mktemp.stdout }}/ca.key'
|
|
|
+ --signer-serial='{{ mktemp.stdout }}/ca.serial.txt'
|
|
|
|
|
|
- slurp: src={{item}}
|
|
|
register: component_certs
|
|
|
with_items:
|
|
|
- - '{{ openshift_metrics_certs_dir | quote }}/{{ component|quote }}.key'
|
|
|
- - '{{ openshift_metrics_certs_dir | quote }}/{{ component|quote }}.crt'
|
|
|
- when: not '{{ openshift_metrics_certs_dir }}/{{ component }}.pem'|exists
|
|
|
+ - '{{ mktemp.stdout | quote }}/{{ component|quote }}.key'
|
|
|
+ - '{{ mktemp.stdout | quote }}/{{ component|quote }}.crt'
|
|
|
|
|
|
- name: generate {{ component }} certificate
|
|
|
copy:
|
|
|
- dest: '{{ openshift_metrics_certs_dir }}/{{ component }}.pem'
|
|
|
+ dest: '{{ mktemp.stdout }}/{{ component }}.pem'
|
|
|
content: "{{ component_certs.results | map(attribute='content') | map('b64decode') | join('') }}"
|
|
|
- when: not '{{ openshift_metrics_certs_dir }}/{{ component }}.pem'|exists
|
|
|
|
|
|
- name: generate random password for the {{ component }} keystore
|
|
|
copy:
|
|
|
content: "{{ 15 | oo_random_word }}"
|
|
|
- dest: '{{ openshift_metrics_certs_dir }}/{{ component }}-keystore.pwd'
|
|
|
- when: >
|
|
|
- not '{{ openshift_metrics_certs_dir }}/{{ component }}-keystore.pwd'|exists
|
|
|
+ dest: '{{ mktemp.stdout }}/{{ component }}-keystore.pwd'
|
|
|
|
|
|
-- slurp: src={{ openshift_metrics_certs_dir | quote }}/{{ component|quote }}-keystore.pwd
|
|
|
+- slurp: src={{ mktemp.stdout | quote }}/{{ component|quote }}-keystore.pwd
|
|
|
register: keystore_password
|
|
|
|
|
|
- name: create the {{ component }} pkcs12 from the pem file
|
|
|
command: >
|
|
|
openssl pkcs12 -export
|
|
|
- -in '{{ openshift_metrics_certs_dir }}/{{ component }}.pem'
|
|
|
- -out '{{ openshift_metrics_certs_dir }}/{{ component }}.pkcs12'
|
|
|
+ -in '{{ mktemp.stdout }}/{{ component }}.pem'
|
|
|
+ -out '{{ mktemp.stdout }}/{{ component }}.pkcs12'
|
|
|
-name '{{ component }}' -noiter -nomaciter
|
|
|
-password 'pass:{{keystore_password.content | b64decode }}'
|
|
|
- when: not '{{ openshift_metrics_certs_dir }}/{{ component }}.pkcs12'|exists
|
|
|
|
|
|
- name: generate random password for the {{ component }} truststore
|
|
|
copy:
|
|
|
content: "{{ 15 | oo_random_word }}"
|
|
|
- dest: '{{ openshift_metrics_certs_dir | quote }}/{{ component|quote }}-truststore.pwd'
|
|
|
- when: >
|
|
|
- not
|
|
|
- '{{ openshift_metrics_certs_dir | quote }}/{{ component| quote }}-truststore.pwd'|exists
|
|
|
+ dest: '{{ mktemp.stdout | quote }}/{{ component|quote }}-truststore.pwd'
|