summaryrefslogtreecommitdiffstats
path: root/roles/openshift_persistent_volumes/tasks/pv.yml
blob: 865269b7aefa50f96484d6fa705b49d8b9ab1743 (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_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) and pv_create_output.rc != 0"
  changed_when: ('created' in pv_create_output.stdout)