xoxys.postgres/tasks/storage.yml

37 lines
1.1 KiB
YAML
Raw Normal View History

2019-06-20 13:55:07 +00:00
---
- block:
- 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(',') }}"
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