2019-06-20 13:55:07 +00:00
|
|
|
---
|
|
|
|
- block:
|
2019-06-22 15:00:30 +00:00
|
|
|
- name: Setup base folder and set permissions
|
|
|
|
file:
|
|
|
|
path: "{{ postgres_base_dir }}"
|
|
|
|
state: directory
|
|
|
|
owner: "{{ postgres_user }}"
|
|
|
|
group: "{{ postgres_group }}"
|
|
|
|
mode: 0700
|
|
|
|
|
2019-06-20 13:55:07 +00:00
|
|
|
- name: Create volume group '{{ postgres_lvm_vg }}'
|
|
|
|
lvg:
|
|
|
|
vg: "{{ postgres_lvm_vg }}"
|
|
|
|
pvs: "{{ postgres_lvm_pvs | join(',') }}"
|
2019-06-30 15:00:25 +00:00
|
|
|
pesize: "4"
|
2019-06-20 13:55:07 +00:00
|
|
|
|
|
|
|
- name: Create logical volume '{{ postgres_lvm_lv }}'
|
|
|
|
lvol:
|
|
|
|
vg: "{{ postgres_lvm_vg }}"
|
|
|
|
lv: "{{ postgres_lvm_lv }}"
|
|
|
|
size: "{{ postgres_lvm_size }}"
|
|
|
|
|
|
|
|
- name: Create filesystem for '/dev/mapper/{{ postgres_lvm_vg }}-{{ postgres_lvm_lv }}'
|
|
|
|
filesystem:
|
|
|
|
fstype: "{{ postgres_lvm_fstype }}"
|
|
|
|
dev: "/dev/mapper/{{ postgres_lvm_vg }}-{{ postgres_lvm_lv }}"
|
|
|
|
resizefs: True
|
|
|
|
|
|
|
|
- name: Mount volume to '{{ postgres_base_dir }}'
|
|
|
|
mount:
|
|
|
|
path: "{{ postgres_base_dir }}"
|
|
|
|
src: "/dev/mapper/{{ postgres_lvm_vg }}-{{ postgres_lvm_lv }}"
|
|
|
|
fstype: "{{ postgres_lvm_fstype }}"
|
|
|
|
state: mounted
|
|
|
|
become: True
|
|
|
|
become_user: root
|