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:
|
2017-08-31 21:33:23 +08:00
|
|
|
|
2019-01-31 05:42:42 +08:00
|
|
|
- block:
|
|
|
|
- name: check if it is atomic host
|
|
|
|
stat:
|
|
|
|
path: /run/ostree-booted
|
|
|
|
register: stat_ostree
|
|
|
|
tags:
|
|
|
|
- always
|
2018-10-10 04:45:05 +08:00
|
|
|
|
2019-01-31 05:42:42 +08:00
|
|
|
- name: set_fact is_atomic
|
|
|
|
set_fact:
|
|
|
|
is_atomic: '{{ stat_ostree.stat.exists }}'
|
|
|
|
tags:
|
|
|
|
- always
|
2018-10-10 04:45:05 +08:00
|
|
|
|
2019-01-31 05:42:42 +08:00
|
|
|
# Some images may not have lvm2 installed
|
|
|
|
- name: install lvm2
|
|
|
|
package:
|
|
|
|
name: lvm2
|
|
|
|
state: present
|
|
|
|
register: result
|
|
|
|
until: result is succeeded
|
|
|
|
when:
|
|
|
|
- not is_atomic
|
2018-10-10 01:40:38 +08:00
|
|
|
|
2019-01-31 05:42:42 +08:00
|
|
|
- name: create physical volume
|
|
|
|
command: pvcreate /dev/sdb
|
|
|
|
failed_when: false
|
2017-07-26 02:46:22 +08:00
|
|
|
|
2019-01-31 05:42:42 +08:00
|
|
|
- name: create volume group
|
|
|
|
command: vgcreate test_group /dev/sdb
|
|
|
|
failed_when: false
|
2017-07-26 02:46:22 +08:00
|
|
|
|
2019-01-31 05:42:42 +08:00
|
|
|
- name: create logical volume 1
|
|
|
|
command: lvcreate --yes -l 50%FREE -n data-lv1 test_group
|
|
|
|
failed_when: false
|
2017-08-31 04:53:28 +08:00
|
|
|
|
2019-01-31 05:42:42 +08:00
|
|
|
- name: create logical volume 2
|
|
|
|
command: lvcreate --yes -l 50%FREE -n data-lv2 test_group
|
|
|
|
failed_when: false
|
2017-08-31 04:53:28 +08:00
|
|
|
|
2019-01-31 05:42:42 +08:00
|
|
|
- name: partition /dev/sdc for journals
|
|
|
|
parted:
|
|
|
|
device: /dev/sdc
|
|
|
|
number: 1
|
|
|
|
part_start: 0%
|
|
|
|
part_end: 50%
|
|
|
|
unit: '%'
|
|
|
|
label: gpt
|
|
|
|
state: present
|
2017-08-31 04:53:28 +08:00
|
|
|
|
2019-01-31 05:42:42 +08:00
|
|
|
- name: partition /dev/sdc for journals
|
|
|
|
parted:
|
|
|
|
device: /dev/sdc
|
|
|
|
number: 2
|
|
|
|
part_start: 50%
|
|
|
|
part_end: 100%
|
|
|
|
unit: '%'
|
|
|
|
state: present
|
|
|
|
label: gpt
|
2017-08-31 04:53:28 +08:00
|
|
|
|
2019-01-31 05:42:42 +08:00
|
|
|
- name: create journals vg from /dev/sdc2
|
|
|
|
lvg:
|
|
|
|
vg: journals
|
|
|
|
pvs: /dev/sdc2
|
2017-08-31 04:53:28 +08:00
|
|
|
|
2019-01-31 05:42:42 +08:00
|
|
|
- name: create journal1 lv
|
|
|
|
command: lvcreate --yes -l 100%FREE -n journal1 journals
|
|
|
|
failed_when: false
|
|
|
|
when: osd_scenario == 'lvm'
|