summaryrefslogtreecommitdiffstats
path: root/roles/openshift_named_certificates/tasks/main.yml
blob: 021fa83855c5318cf3b86b2ed3e9fef878c73fb0 (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
---
- set_fact:
    parsed_named_certificates: "{{ named_certificates | lib_utils_oo_parse_named_certificates(named_certs_dir, internal_hostnames) }}"
  when: named_certificates | length > 0
  delegate_to: localhost
  run_once: true

- openshift_facts:
    role: master
    local_facts:
      named_certificates: "{{ parsed_named_certificates | default([]) }}"
    additive_facts_to_overwrite:
    - "{{ 'master.named_certificates' if overwrite_named_certs | bool else omit }}"

- name: Clear named certificates
  file:
    path: "{{ named_certs_dir }}"
    state: absent
  when: overwrite_named_certs | bool

- name: Ensure named certificate directory exists
  file:
    path: "{{ named_certs_dir }}"
    state: directory
    mode: 0700

- name: Land named certificates
  copy:
    src: "{{ item.certfile }}"
    dest: "{{ named_certs_dir }}/{{ item.certfile | basename }}"
  with_items: "{{ named_certificates }}"

- name: Land named certificate keys
  copy:
    src: "{{ item.keyfile }}"
    dest: "{{ named_certs_dir }}/{{ item.keyfile | basename }}"
    mode: 0600
  with_items: "{{ named_certificates }}"

- name: Land named CA certificates
  copy:
    src: "{{ item }}"
    dest: "{{ named_certs_dir }}/{{ item | basename }}"
    mode: 0600
  with_items: "{{ named_certificates | lib_utils_oo_collect('cafile') }}"