summaryrefslogtreecommitdiffstats
path: root/installer/roles/kubernetes/tasks/openshift.yml
blob: 4e4ba8f2f98503424db574ba39c6917f93c564af (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
---
- name: Get Project Detail
  shell: "{{ openshift_oc_bin }} get project {{ openshift_project }}"
  register: project_details
  ignore_errors: yes

- name: Create AWX Openshift Project
  shell: "{{ openshift_oc_bin }} new-project {{ openshift_project }}"
  when: project_details.rc != 0

- name: Ensure PostgreSQL PVC is available
  block:
    - name: Check PVC status
      command: "{{ openshift_oc_bin }} get pvc {{ openshift_pg_pvc_name }} -n {{ openshift_project }} -o=jsonpath='{.status.phase}'"
      register: pg_pvc_status
      ignore_errors: yes

    - name: Ensure PostgreSQL PVC is available
      assert:
        that:
          - pg_pvc_status.stdout == "Bound"
        msg: "Ensure a PVC named '{{ openshift_pg_pvc_name }}' is created and bound in the '{{ openshift_project }}' namespace."
  when:
    - pg_hostname is not defined or pg_hostname == ''
    - openshift_pg_emptydir is defined and (openshift_pg_emptydir | bool) != true

- name: Set postgresql service name
  set_fact:
    postgresql_service_name: "postgresql"
  when: "pg_hostname is not defined or pg_hostname == ''"

- name: Add privileged SCC to service account
  shell: |
    {{ openshift_oc_bin }} adm policy add-scc-to-user privileged system:serviceaccount:{{ openshift_project }}:awx