From 79ed07aade2ad43a0cb8ee59f036326030c1b099 Mon Sep 17 00:00:00 2001 From: Xavi Hernandez Date: Fri, 1 Dec 2023 12:19:53 +0000 Subject: [PATCH] Make VMs disk name dependent on the VM prefix Signed-off-by: Xavi Hernandez --- .../roles/provisioner.vagrant/templates/Vagrantfile.j2 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/playbooks/roles/provisioner.vagrant/templates/Vagrantfile.j2 b/playbooks/roles/provisioner.vagrant/templates/Vagrantfile.j2 index bff5b113..324fa5bf 100644 --- a/playbooks/roles/provisioner.vagrant/templates/Vagrantfile.j2 +++ b/playbooks/roles/provisioner.vagrant/templates/Vagrantfile.j2 @@ -33,8 +33,8 @@ Vagrant.configure("2") do |config| {%- endfor +%} node.vm.provider :virtualbox do |vb| {%- for size in node.disks +%} - vb.customize [ "createhd", "--filename", "disk-{{ vm_idx }}{{ loop.index0 }}.vdi", "--size", {{ size * 1024 }} ] - vb.customize [ "storageattach", :id, "--storagectl", "SATA Controller", "--port", {{ loop.index0 + 3 }}, "--device", 0, "--type", "hdd", "--medium", "disk-{{ vm_idx }}{{ loop.index0 }}.vdi" ] + vb.customize [ "createhd", "--filename", "{{ config.vm_prefix }}disk-{{ vm_idx }}{{ loop.index0 }}.vdi", "--size", {{ size * 1024 }} ] + vb.customize [ "storageattach", :id, "--storagectl", "SATA Controller", "--port", {{ loop.index0 + 3 }}, "--device", 0, "--type", "hdd", "--medium", "{{ config.vm_prefix}}disk-{{ vm_idx }}{{ loop.index0 }}.vdi" ] {%- endfor +%} vb.memory = {{ node.memory }} vb.cpus = {{ node.cpus }} @@ -44,7 +44,7 @@ Vagrant.configure("2") do |config| lv.storage_pool_name = "{{ data.pool }}" {%- endif +%} {%- for size in node.disks +%} - lv.storage :file, :device => "vd{{ "bcdefghijklmnopqrstuvwxyz"[loop.index0] }}", :path => "disk-{{ vm_idx }}{{ loop.index0 }}.disk", :size => '{{ size }}G' + lv.storage :file, :device => "vd{{ "bcdefghijklmnopqrstuvwxyz"[loop.index0] }}", :path => "{{ config.vm_prefix }}disk-{{ vm_idx }}{{ loop.index0 }}.disk", :size => '{{ size }}G' {%- endfor +%} lv.memory = {{ node.memory }} lv.cpus = {{ node.cpus }}