xoxys.postgres/tasks/storage.yml
Robert Kaussow ec1574236a
All checks were successful
continuous-integration/drone/push Build is passing
fix permissions for base directory on lvm
2019-06-22 17:00:30 +02:00

36 lines
1.1 KiB
YAML

---
- block:
- name: Setup base folder and set permissions
file:
path: "{{ postgres_base_dir }}"
state: directory
owner: "{{ postgres_user }}"
group: "{{ postgres_group }}"
mode: 0700
- name: Create volume group '{{ postgres_lvm_vg }}'
lvg:
vg: "{{ postgres_lvm_vg }}"
pvs: "{{ postgres_lvm_pvs | join(',') }}"
- 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