diff options
author | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2015-01-27 16:02:16 +0000 |
---|---|---|
committer | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2015-01-30 17:28:21 +0000 |
commit | e81956c83d3100497b83e563420971bed5dacd47 (patch) | |
tree | 4d1b9a1f0357e4c620728409fe73ec7eee213ca8 /tasks | |
parent | 82154ca379476ca5fb047ff9f3efac739c7eea27 (diff) | |
download | infrastructure-e81956c83d3100497b83e563420971bed5dacd47.tar.gz |
Move creation of lvm data volume into a playbook include
Diffstat (limited to 'tasks')
-rw-r--r-- | tasks/create-data-volume.yml | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tasks/create-data-volume.yml b/tasks/create-data-volume.yml new file mode 100644 index 00000000..05b07afe --- /dev/null +++ b/tasks/create-data-volume.yml @@ -0,0 +1,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 + |