Skip to content

Commit

Permalink
Make VMs disk name dependent on the VM prefix
Browse files Browse the repository at this point in the history
Signed-off-by: Xavi Hernandez <[email protected]>
  • Loading branch information
xhernandez committed Dec 14, 2023
1 parent a83e814 commit 79ed07a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions playbooks/roles/provisioner.vagrant/templates/Vagrantfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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 }}
Expand Down

0 comments on commit 79ed07a

Please sign in to comment.