Use hostname for VG name

This commit is contained in:
Tunui Franken 2025-01-10 14:06:42 +01:00
parent 4d2d67aed1
commit e72a1d2284
2 changed files with 4 additions and 4 deletions

2
Vagrantfile vendored
View file

@ -22,7 +22,7 @@ Vagrant.configure("2") do |config|
mailserver.vm.provision "shell" do |shell|
shell.inline = <<-SHELL
apt-get install -y lvm2
vgcreate vg_data /dev/vdb
vgcreate vg_$HOSTNAME /dev/vdb
SHELL
end
end

View file

@ -12,7 +12,7 @@
- name: Create a LV for /var/vmail
become: true
community.general.lvol:
vg: vg_data
vg: "vg_{{ ansible_hostname }}"
lv: vmail
state: present
size: 5g
@ -21,7 +21,7 @@
- name: Format vmail LV to ext4
become: true
community.general.filesystem:
dev: /dev/mapper/vg_data-vmail
dev: "/dev/mapper/vg_{{ ansible_hostname }}-vmail"
fstype: ext4
resizefs: true
state: present
@ -29,7 +29,7 @@
- name: Mount /var/vmail
become: true
ansible.posix.mount:
src: /dev/mapper/vg_data-vmail
src: "/dev/mapper/vg_{{ ansible_hostname }}-vmail"
path: /var/vmail
state: mounted
fstype: ext4