---
- name: Copy heketi secret config file to master
  copy:
    src: ~/heketi-secret.yaml
    dest: ~/heketi-secret.yaml

- name: Copy heketi secret config file to master
  copy:
    src: ~/storage-crs.json
    dest: ~/storage-crs.json

- name: Switch to default project
  command: oc project default

- name: Check to see if heketi secret is already created
  command: "oc get secrets"
  register: oc_secrets

- name: Check to see if storage class is already created
  command: "oc get storageclass"
  register: storage_class

- name: Add heketi secret
  command: "oc create -f ~/heketi-secret.yaml"
  when: "'heketi-secret' not in oc_secrets.stdout"

- name: Create storage class
  command: "oc create -f ~/storage-crs.json"
  when: "'crs-gluster' not in storage_class.stdout"
