---
- name: Create Hosted Resources - persistent volumes
  hosts: oo_first_master
  roles:
  - role: openshift_persistent_volumes

- name: Create Hosted Resources - Persistent Local Storage Provider
  hosts: oo_first_master
  vars:
    persistentlocalstorage_project: "{{ openshift_persistentlocalstorage_project | default('local-storage') }}"
    persistentlocalstorage_classes: "{{ openshift_persistentlocalstorage_classes | default([]) }}"
    persistentlocalstorage_path: "{{ openshift_persistentlocalstorage_path | default('/mnt/local-storage') }}"
  roles:
  - role: openshift_persistentlocalstorage
    when: openshift_persistentlocalstorage_enabled | default(False) | bool

- name: Create Hosted Resources - Persistent Local Storage Classes
  hosts: nodes
  tasks:
  - name: Create Persistent Local Storage Classes Directories
    file:
      path: "{{ openshift_persistentlocalstorage_path | default('/mnt/local-storage') }}/{{ item }}"
      owner: root
      group: root
      mode: 0770
      state: directory
      setype: svirt_sandbox_file_t
    with_items: "{{ openshift_persistentlocalstorage_classes }}"
    when: openshift_persistentlocalstorage_classes | default([]) | length > 0 and openshift_persistentlocalstorage_enabled | bool
