summaryrefslogtreecommitdiffstats
path: root/roles/openshift_persistent_volumes/tasks/main.yml
blob: b1d9c8ccafb8e00878c125d618ae91583b89f750 (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
46
47
48
---
- name: Create temp directory for volume definitions
  command: mktemp -d /tmp/openshift-ansible-XXXXXXX
  register: mktemp
  changed_when: False

- name: Copy the admin client config(s)
  command: >
    cp {{ openshift_master_config_dir }}/admin.kubeconfig {{ mktemp.stdout }}/admin.kubeconfig
  changed_when: False

- set_fact:
    glusterfs_pv:
    - name: "{{ openshift_hosted_registry_storage_volume_name }}-glusterfs-volume"
      capacity: "{{ openshift_hosted_registry_storage_volume_size }}"
      access_modes: "{{ openshift_hosted_registry_storage_access_modes }}"
      storage:
        glusterfs:
          endpoints: "{{ openshift_hosted_registry_storage_glusterfs_endpoints }}"
          path: "{{ openshift_hosted_registry_storage_glusterfs_path }}"
          readOnly: "{{ openshift_hosted_registry_storage_glusterfs_readOnly }}"
    glusterfs_pvc:
    - name: "{{ openshift_hosted_registry_storage_volume_name }}-glusterfs-claim"
      capacity: "{{ openshift_hosted_registry_storage_volume_size }}"
      access_modes: "{{ openshift_hosted_registry_storage_access_modes }}"
  when: openshift_hosted_registry_storage_glusterfs_swap | default(False)

- name: create standard pv and pvc lists
  # generate_pv_pvcs_list is a custom action module defined in
  # roles/lib_utils/action_plugins/generate_pv_pvcs_list.py
  generate_pv_pvcs_list: {}
  register: l_pv_pvcs_list

- include_tasks: pv.yml
  vars:
    l_extra_persistent_volumes: "{{ openshift_persistent_volume_extras | union(glusterfs_pv) }}"
    persistent_volumes: "{{ l_pv_pvcs_list.persistent_volumes | union(l_extra_persistent_volumes) }}"

- include_tasks: pvc.yml
  vars:
    l_extra_persistent_volume_claims: "{{ openshift_persistent_volume_claims_extras | union(glusterfs_pvc) }}"
    persistent_volume_claims: "{{ l_pv_pvcs_list.persistent_volume_claims | union(l_extra_persistent_volume_claims) }}"

- name: Delete temp directory
  file:
    name: "{{ mktemp.stdout }}"
    state: absent
  changed_when: False