summaryrefslogtreecommitdiff
path: root/tasks/create-data-volume.yml
blob: 05b07afe19ece1463c19b1dafa966d8f12d7d2d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Format a volume for data storage
#
# The pattern is to create an LVM volume group on the volume, with
# one logical volume set up. Snapshots can be taken of the data LV
# very quickly, allowing us to take backup copies without requiring
# long periods of downtime for the relevant services.
---

- name: ensure LVM metadata service is running
  service: name=lvm2-lvmetad enabled=yes state=started

- name: LVM logical volume group on /dev/vdb
  lvg: vg=vg0 pvs=/dev/vdb

- name: logical volume for {{ lv_name }}
  lvol: vg=vg0 lv={{ lv_name }} size={{ lv_size }}

# This will NEVER overwrite an existing filesystem. Unless you add
# 'force=yes' to the arguments. So don't do that. See:
# http://docs.ansible.com/filesystem_module.html.
- name: ext4 filesystem on /dev/vg0/{{ lv_name }}
  filesystem: fstype=ext4 dev=/dev/vg0/{{ lv_name }}

- name: mount {{ lv_name }} logical volume
  mount: src=/dev/vg0/{{ lv_name }} name={{ mountpoint }} fstype=ext4 state=mounted