summaryrefslogtreecommitdiffstats
path: root/roles/openshift_persistent_volumes/tasks/pv.yml
blob: 346605ff7af1f90a90030275e3c8932a663eef27 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
---
- name: Deploy PersistentVolume definitions
  template:
    dest: "{{ mktemp.stdout }}/persistent-volumes.yml"
    src: persistent-volume.yml.j2
  when: persistent_volumes | length > 0
  changed_when: False

- name: Create PersistentVolumes
  command: >
    {{ openshift.common.client_binary }} create
    -f {{ mktemp.stdout }}/persistent-volumes.yml
    --config={{ mktemp.stdout }}/admin.kubeconfig
  register: pv_create_output
  when: persistent_volumes | length > 0
  failed_when: ('already exists' not in pv_create_output.stderr) and ('created' not in pv_create_output.stdout)
  changed_when: ('created' in pv_create_output.stdout)