add lvm management
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Robert Kaussow 2019-06-20 15:55:07 +02:00
parent 2c6387ef6d
commit 8d147ff130
3 changed files with 41 additions and 0 deletions

View File

@ -5,6 +5,18 @@ postgres_repository_filename: "Postgresql-{{ postgres_version | regex_replace('\
postgres_user: postgres
postgres_group: postgres
# Create separate LVM storage for matrix
postgres_lvm_enabled: False
# This variables are only necessary if postgres_lvm_enabled is 'True'
# Set physical volumes to use in LVM
# postgres_lvm_pvs: # ['/dev/sdb', '/dev/sdc']
# postgres_lvm_vg: # "vg_matrix"
# postgres_lvm_lv: # "lv_matrix"
# postgres_lvm_fstype: # "ext4"
# postgres_lvm_size: # "50G"
# postgres_base_dir: # defaults to os default
# Available postgresql.conf options
postgres_log_destination:
- stderr

View File

@ -1,5 +1,7 @@
---
- import_tasks: prepare.yml
- import_tasks: storage.yml
when: postgres_lvm_enabled | bool
- import_tasks: install.yml
- import_tasks: config.yml
- import_tasks: tls.yml

27
tasks/storage.yml Normal file
View File

@ -0,0 +1,27 @@
---
- block:
- 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