2018-06-25 11:23:20 +00:00
|
|
|
---
|
|
|
|
- name: "Get heketi volume ids."
|
|
|
|
command: "heketi-cli -s http://localhost:48080 volume list --json"
|
|
|
|
changed_when: false
|
|
|
|
register: "heketi_volumes"
|
|
|
|
- name: "Get heketi volumes."
|
|
|
|
changed_when: false
|
|
|
|
command: "heketi-cli -s http://localhost:48080 volume info {{ volume_id }} --json"
|
|
|
|
with_items: "{{ heketi_volumes.stdout|from_json|json_query(\"volumes[*]\") }}"
|
|
|
|
loop_control: { loop_var: "volume_id" }
|
|
|
|
register: "volumes_information"
|
|
|
|
- name: "Test heketi database volume."
|
|
|
|
set_fact: { heketi_database_volume_exists: true }
|
|
|
|
with_items: "{{ volumes_information.results }}"
|
|
|
|
loop_control: { loop_var: "volume_information" }
|
|
|
|
vars: { volume: "{{ volume_information.stdout|from_json }}" }
|
|
|
|
when: "volume.name == 'heketidbstorage'"
|
|
|
|
- name: "Provision database volume."
|
2018-06-27 08:12:23 +00:00
|
|
|
command: "heketi-cli -s http://localhost:48080 setup-openshift-heketi-storage"
|
|
|
|
when: "heketi_database_volume_exists is undefined"
|
|
|
|
- name: "Get heketi volume ids."
|
|
|
|
command: "heketi-cli -s http://localhost:48080 volume list --json"
|
|
|
|
changed_when: false
|
|
|
|
register: "heketi_volumes"
|
|
|
|
- name: "Get heketi volumes."
|
|
|
|
changed_when: false
|
|
|
|
command: "heketi-cli -s http://localhost:48080 volume info {{ volume_id }} --json"
|
|
|
|
with_items: "{{ heketi_volumes.stdout|from_json|json_query(\"volumes[*]\") }}"
|
|
|
|
loop_control: { loop_var: "volume_id" }
|
|
|
|
register: "volumes_information"
|
|
|
|
- name: "Test heketi database volume."
|
|
|
|
set_fact: { heketi_database_volume_created: true }
|
|
|
|
with_items: "{{ volumes_information.results }}"
|
|
|
|
loop_control: { loop_var: "volume_information" }
|
|
|
|
vars: { volume: "{{ volume_information.stdout|from_json }}" }
|
|
|
|
when: "volume.name == 'heketidbstorage'"
|
|
|
|
- name: "Ensure heketi database volume exists."
|
|
|
|
assert: { that: "heketi_database_volume_created is defined" , msg: "Heketi database volume does not exist." }
|