summaryrefslogtreecommitdiffstats
path: root/ci/ansible/roles/osdsdock/scenarios/lvm.yml
blob: 5847aa32c831c8842297376785c735a49423604e (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: install lvm2 external package when lvm backend enabled
  apt:
    name: lvm2

- name: copy opensds lvm backend file if specify lvm backend
  copy:
    src: ../../../group_vars/lvm/lvm.yaml
    dest: "{{ lvm_config_path }}"

- name: check if physical volume existed
  shell: pvdisplay {{ pv_device }}
  ignore_errors: yes
  register: pv_existed

- name: create a physical volume
  shell: pvcreate {{ pv_device }}
  when: pv_existed is undefined or pv_existed.rc != 0

- name: check if volume group existed
  shell: vgdisplay {{ vg_name }}
  ignore_errors: yes
  register: vg_existed

- name: create a volume group
  shell: vgcreate {{ vg_name }} {{ pv_device }}
  when: vg_existed is undefined or vg_existed.rc != 0