2017-07-26 02:46:22 +08:00
|
|
|
---
|
2019-01-16 13:57:02 +08:00
|
|
|
- hosts: all
|
|
|
|
gather_facts: false
|
|
|
|
become: yes
|
|
|
|
tasks:
|
|
|
|
- import_tasks: ../../raw_install_python.yml
|
2017-07-26 02:46:22 +08:00
|
|
|
|
|
|
|
- hosts: osds
|
2018-10-10 04:45:05 +08:00
|
|
|
gather_facts: false
|
2017-07-26 02:46:22 +08:00
|
|
|
become: yes
|
|
|
|
tasks:
|
2019-04-11 16:01:15 +08:00
|
|
|
- name: check if it is atomic host
|
|
|
|
stat:
|
|
|
|
path: /run/ostree-booted
|
|
|
|
register: stat_ostree
|
2019-04-01 23:46:15 +08:00
|
|
|
tags: always
|
2020-07-22 13:28:34 +08:00
|
|
|
|
2019-04-11 16:01:15 +08:00
|
|
|
- name: set_fact is_atomic
|
|
|
|
set_fact:
|
|
|
|
is_atomic: '{{ stat_ostree.stat.exists }}'
|
2019-04-01 23:46:15 +08:00
|
|
|
tags: always
|
2020-07-22 13:28:34 +08:00
|
|
|
|
2019-04-11 16:01:15 +08:00
|
|
|
# Some images may not have lvm2 installed
|
|
|
|
- name: install lvm2
|
|
|
|
package:
|
|
|
|
name: lvm2
|
|
|
|
state: present
|
|
|
|
register: result
|
|
|
|
until: result is succeeded
|
2019-05-22 16:02:42 +08:00
|
|
|
when: not is_atomic | bool
|
2020-07-22 13:28:34 +08:00
|
|
|
|
2019-04-11 16:01:15 +08:00
|
|
|
- name: create volume group
|
2019-10-18 02:28:45 +08:00
|
|
|
lvg:
|
|
|
|
vg: test_group
|
2020-02-10 17:09:14 +08:00
|
|
|
pvs: "{{ pv_devices[0] | default('/dev/sdb') }}"
|
2020-07-22 13:28:34 +08:00
|
|
|
|
2019-04-11 16:01:15 +08:00
|
|
|
- name: create logical volume 1
|
2019-10-18 02:28:45 +08:00
|
|
|
lvol:
|
|
|
|
vg: test_group
|
|
|
|
lv: data-lv1
|
|
|
|
size: 50%FREE
|
2020-07-22 07:51:20 +08:00
|
|
|
shrink: false
|
2020-07-22 13:28:34 +08:00
|
|
|
|
2019-04-11 16:01:15 +08:00
|
|
|
- name: create logical volume 2
|
2019-10-18 02:28:45 +08:00
|
|
|
lvol:
|
|
|
|
vg: test_group
|
|
|
|
lv: data-lv2
|
|
|
|
size: 100%FREE
|
2020-07-22 07:51:20 +08:00
|
|
|
shrink: false
|
2020-07-22 13:28:34 +08:00
|
|
|
|
2020-02-10 17:09:14 +08:00
|
|
|
- name: partition "{{ pv_devices[1] | default('/dev/sdc') }}"for journals
|
2019-04-11 16:01:15 +08:00
|
|
|
parted:
|
2020-02-10 17:09:14 +08:00
|
|
|
device: "{{ pv_devices[1] | default('/dev/sdc') }}"
|
2019-04-11 16:01:15 +08:00
|
|
|
number: 1
|
|
|
|
part_start: 0%
|
|
|
|
part_end: 50%
|
|
|
|
unit: '%'
|
|
|
|
label: gpt
|
|
|
|
state: present
|
2020-01-21 05:40:58 +08:00
|
|
|
tags: partitions
|
2020-07-22 13:28:34 +08:00
|
|
|
|
2020-02-10 17:09:14 +08:00
|
|
|
- name: partition "{{ pv_devices[1] | default('/dev/sdc') }}"for journals
|
2019-04-11 16:01:15 +08:00
|
|
|
parted:
|
2020-02-10 17:09:14 +08:00
|
|
|
device: "{{ pv_devices[1] | default('/dev/sdc') }}"
|
2019-04-11 16:01:15 +08:00
|
|
|
number: 2
|
|
|
|
part_start: 50%
|
|
|
|
part_end: 100%
|
|
|
|
unit: '%'
|
|
|
|
state: present
|
|
|
|
label: gpt
|
2020-01-21 05:40:58 +08:00
|
|
|
tags: partitions
|
2020-07-22 13:28:34 +08:00
|
|
|
|
2020-02-10 17:09:14 +08:00
|
|
|
- name: create journals vg from "{{ pv_devices[1] | default('/dev/sdc') }}2"
|
2019-04-11 16:01:15 +08:00
|
|
|
lvg:
|
|
|
|
vg: journals
|
2020-02-10 17:09:14 +08:00
|
|
|
pvs: "{{ pv_devices[1] | default('/dev/sdc') }}2"
|
2020-07-22 13:28:34 +08:00
|
|
|
|
2019-04-11 16:01:15 +08:00
|
|
|
- name: create journal1 lv
|
2019-10-18 02:28:45 +08:00
|
|
|
lvol:
|
|
|
|
vg: journals
|
|
|
|
lv: journal1
|
|
|
|
size: 100%FREE
|
2020-07-22 07:51:20 +08:00
|
|
|
shrink: false
|