diff options
author | Scott Dodson <sdodson@redhat.com> | 2017-01-17 15:33:43 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-17 15:33:43 -0500 |
commit | a269ece3556932cebfa2ade968ac2b8638c2abbf (patch) | |
tree | bb690323269d929c9582756b4a77c8189217dcf4 /roles/openshift_metrics/tasks/generate_heapster_certificates.yaml | |
parent | e810fb6abab0c6fe9198bfc3f39c82ca8054f76e (diff) | |
parent | 65eb7e43faf38698b22b90ad3c743d1fecdc0961 (diff) | |
download | openshift-a269ece3556932cebfa2ade968ac2b8638c2abbf.tar.gz openshift-a269ece3556932cebfa2ade968ac2b8638c2abbf.tar.bz2 openshift-a269ece3556932cebfa2ade968ac2b8638c2abbf.tar.xz openshift-a269ece3556932cebfa2ade968ac2b8638c2abbf.zip |
Merge pull request #2873 from jcantrill/295_metrics_admin_again
Move Metrics to ansible from deployer
Diffstat (limited to 'roles/openshift_metrics/tasks/generate_heapster_certificates.yaml')
-rw-r--r-- | roles/openshift_metrics/tasks/generate_heapster_certificates.yaml | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/roles/openshift_metrics/tasks/generate_heapster_certificates.yaml b/roles/openshift_metrics/tasks/generate_heapster_certificates.yaml new file mode 100644 index 000000000..2449b1518 --- /dev/null +++ b/roles/openshift_metrics/tasks/generate_heapster_certificates.yaml @@ -0,0 +1,41 @@ +--- +- name: generate heapster key/cert + command: > + {{ openshift.common.admin_binary }} ca create-server-cert + --config={{ mktemp.stdout }}/admin.kubeconfig + --key='{{ openshift_metrics_certs_dir }}/heapster.key' + --cert='{{ openshift_metrics_certs_dir }}/heapster.cert' + --hostnames=heapster + --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 }}/heapster.key' | exists + +- when: "'secret/heapster-secrets' not in metrics_secrets.stdout_lines" + block: + - name: read files for the heapster secret + slurp: src={{ item }} + register: heapster_secret + with_items: + - "{{ openshift_metrics_certs_dir }}/heapster.cert" + - "{{ openshift_metrics_certs_dir }}/heapster.key" + - "{{ client_ca }}" + vars: + custom_ca: "{{ openshift_metrics_certs_dir }}/heapster_client_ca.crt" + default_ca: "{{ openshift.common.config_base }}/master/ca-bundle.crt" + client_ca: "{{ custom_ca|exists|ternary(custom_ca, default_ca) }}" + - name: generate heapster secret template + template: + src: secret.j2 + dest: "{{ mktemp.stdout }}/templates/heapster_secrets.yaml" + force: no + vars: + name: heapster-secrets + labels: + metrics-infra: heapster + data: + heapster.cert: "{{ heapster_secret.results[0].content }}" + heapster.key: "{{ heapster_secret.results[1].content }}" + heapster.client-ca: "{{ heapster_secret.results[2].content }}" + heapster.allowed-users: > + {{ openshift_metrics_heapster_allowed_users|b64encode }} |