summaryrefslogtreecommitdiffstats
path: root/playbooks/libvirt/openshift-cluster/tasks/configure_libvirt_storage_pool.yml
blob: 817acb2507f2a58fc2fb2d3209e518a1abd11a8a (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
---
- name: Create libvirt storage directory for openshift
  file:
    dest: "{{ libvirt_storage_pool_path }}"
    state: directory

- acl:
    default: yes
    entity: kvm
    etype: group
    name: "{{ libvirt_storage_pool_path }}"
    permissions: rwx
    state: present

- name: Test if libvirt storage pool for openshift already exists
  command: "virsh -c {{ libvirt_uri }} pool-info {{ libvirt_storage_pool }}"
  register: pool_info_result
  changed_when: False
  failed_when: "pool_info_result.rc != 0 and 'error: Storage pool not found:' not in pool_info_result.stderr"

- name: Create the libvirt storage pool for openshift
  command: 'virsh -c {{ libvirt_uri }} pool-create-as {{ libvirt_storage_pool }} dir --target {{ libvirt_storage_pool_path }}'
  when: pool_info_result.rc == 1

- name: Refresh the libvirt storage pool for openshift
  command: 'virsh -c {{ libvirt_uri }} pool-refresh {{ libvirt_storage_pool }}'
  when: pool_info_result.rc == 1