Prepare a block EBS device and create volume group, logical volume, filesystem and fstab entry. This role is necessary for instances that store services' data on separated EBS for persistence.
- An EC2 instance running Ubuntu 18.04 minimal having EBS other than the root devices attached.
A configuration block like this is required:
---
- hosts: jenkins_master
gather_facts: true
become: true
vars:
ansible_ssh_user : "ubuntu"
ansible_ssh_private_key_file : "~/.ssh/nfq-tools"
ansible_python_interpreter : "/usr/bin/python3"
project_name : "nfq"
env : "tools"
terraform_version : "0.12.6"
terraform_dir : "/var/lib/terraform-0.12.6"
ansible_version : "2.8.1"
awscli_version : "1.16.225"
roles:
- role: nfq.lvm
vars:
lvm_config:
pvs:
- "/dev/nvme1n1"
vgs:
data:
pvs:
- "/dev/nvme1n1"
lvs:
- name: "jenkins"
vg: data
size: "+100%FREE"
filesystems_config:
data:
dev: "/dev/data/jenkins"
type: ext4
opts: ''
mounts_config:
data:
dev: "/dev/data/jenkins"
fstype: ext4
opts: 'noatime,nodiratime'
mountpoint: "/var/lib/jenkins"
dump: '0'
passno: '2'
state: mounted
pvs
: a list of devices to be used as the physical volumesvgs
: one or more volume group and its componentpvs
, in a listlvs
: a list of one or more logical volume:name
: name of the logical volumevg
: the volume group that this volume resides insize
: Size of the volume, following lvcreate syntax.
dev
: device path pointing to the logical volumetype
: filesystem type. Note: The role will not manage dependency of filesystems type (i.e. playbooks need to install mkfs packages on their own)opts
:mkfs
additional options
Configs that correspond to an /etc/fstab
entry
n/a
n/a
install
: Create the setEBS > VG > LV > filesystem
n/a