move lvm handler to own task file
This commit is contained in:
parent
7358350e39
commit
eff3961ab8
@ -30,40 +30,6 @@
|
|||||||
state: directory
|
state: directory
|
||||||
when: mongodb_systemlog_destination == 'file'
|
when: mongodb_systemlog_destination == 'file'
|
||||||
|
|
||||||
- block:
|
|
||||||
- name: Create volume group 'mongodb_lvm_vg'
|
|
||||||
lvg:
|
|
||||||
vg: "{{ mongodb_lvm_vg }}"
|
|
||||||
pvs: "{{ mongodb_lvm_pvs|join(',') }}"
|
|
||||||
|
|
||||||
- name: Create logical volume 'mongodb_lvm_lv'
|
|
||||||
lvol:
|
|
||||||
vg: "{{ mongodb_lvm_vg }}"
|
|
||||||
lv: "{{ mongodb_lvm_lv }}"
|
|
||||||
size: "{{ mongodb_lvm_size }}"
|
|
||||||
|
|
||||||
- name: Create filesystem for '/dev/mapper/{{ mongodb_lvm_vg }}-{{ mongodb_lvm_lv }}'
|
|
||||||
filesystem:
|
|
||||||
fstype: "{{ mongodb_lvm_fstype }}"
|
|
||||||
dev: "/dev/mapper/{{ mongodb_lvm_vg }}-{{ mongodb_lvm_lv }}"
|
|
||||||
|
|
||||||
- name: Mount volume to 'mongodb_storage_dbpath'
|
|
||||||
mount:
|
|
||||||
path: "{{ mongodb_storage_dbpath }}"
|
|
||||||
src: "/dev/mapper/{{ mongodb_lvm_vg }}-{{ mongodb_lvm_lv }}"
|
|
||||||
fstype: "{{ mongodb_lvm_fstype }}"
|
|
||||||
state: mounted
|
|
||||||
|
|
||||||
- name: Change permissions for mountpoint
|
|
||||||
file:
|
|
||||||
path: "{{ mongodb_storage_dbpath }}"
|
|
||||||
owner: "{{ mongodb_user }}"
|
|
||||||
group: "{{ mongodb_group }}"
|
|
||||||
mode: 0750
|
|
||||||
become: True
|
|
||||||
when: mongodb_lvm_enabled
|
|
||||||
|
|
||||||
- block:
|
|
||||||
- name: Deploy configuration file
|
- name: Deploy configuration file
|
||||||
template:
|
template:
|
||||||
src: etc/mongod.conf.j2
|
src: etc/mongod.conf.j2
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
---
|
---
|
||||||
- include_tasks: install.yml
|
- include_tasks: install.yml
|
||||||
|
|
||||||
|
- include_tasks: storage.yml
|
||||||
|
when: mongodb_lvm_enabled
|
||||||
|
|
||||||
- include_tasks: config.yml
|
- include_tasks: config.yml
|
||||||
|
|
||||||
- name: Check where admin user already exists
|
- name: Check where admin user already exists
|
||||||
|
32
tasks/storage.yml
Normal file
32
tasks/storage.yml
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
---
|
||||||
|
- block:
|
||||||
|
- name: Create volume group 'mongodb_lvm_vg'
|
||||||
|
lvg:
|
||||||
|
vg: "{{ mongodb_lvm_vg }}"
|
||||||
|
pvs: "{{ mongodb_lvm_pvs|join(',') }}"
|
||||||
|
|
||||||
|
- name: Create logical volume 'mongodb_lvm_lv'
|
||||||
|
lvol:
|
||||||
|
vg: "{{ mongodb_lvm_vg }}"
|
||||||
|
lv: "{{ mongodb_lvm_lv }}"
|
||||||
|
size: "{{ mongodb_lvm_size }}"
|
||||||
|
|
||||||
|
- name: Create filesystem for '/dev/mapper/{{ mongodb_lvm_vg }}-{{ mongodb_lvm_lv }}'
|
||||||
|
filesystem:
|
||||||
|
fstype: "{{ mongodb_lvm_fstype }}"
|
||||||
|
dev: "/dev/mapper/{{ mongodb_lvm_vg }}-{{ mongodb_lvm_lv }}"
|
||||||
|
|
||||||
|
- name: Mount volume to 'mongodb_storage_dbpath'
|
||||||
|
mount:
|
||||||
|
path: "{{ mongodb_storage_dbpath }}"
|
||||||
|
src: "/dev/mapper/{{ mongodb_lvm_vg }}-{{ mongodb_lvm_lv }}"
|
||||||
|
fstype: "{{ mongodb_lvm_fstype }}"
|
||||||
|
state: mounted
|
||||||
|
|
||||||
|
- name: Change permissions for mountpoint
|
||||||
|
file:
|
||||||
|
path: "{{ mongodb_storage_dbpath }}"
|
||||||
|
owner: "{{ mongodb_user }}"
|
||||||
|
group: "{{ mongodb_group }}"
|
||||||
|
mode: 0750
|
||||||
|
become: True
|
Loading…
Reference in New Issue
Block a user