From 7ed3be574a2acf0a600fdee488e2efcdd42ec836 Mon Sep 17 00:00:00 2001 From: strNophix Date: Thu, 7 Apr 2022 14:01:41 +0200 Subject: [PATCH] Only shows section in vagrantfile when applicable --- templates/Vagrantfile.template | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/templates/Vagrantfile.template b/templates/Vagrantfile.template index e21e558..9192965 100644 --- a/templates/Vagrantfile.template +++ b/templates/Vagrantfile.template @@ -10,11 +10,10 @@ Vagrant.configure("2") do |config| config.ssh.insert_key = false config.ssh.private_key_path = ["./.ssh/id_rsa","~/.vagrant.d/insecure_private_key"] - num_webserver = {{ num_webserver }} - num_loadbalancer = {{ num_loadbalancers }} num_postgresql = {{ num_postgres }} - (1..num_webserver).each do |nth| + {% if webserver_specs is not none %} + (1..{{ num_webserver }}).each do |nth| machine_id = "{{ customer_name }}-{{ env }}-web%d" % [nth] machine_ip = increment_ip() @@ -33,8 +32,10 @@ Vagrant.configure("2") do |config| end end end + {% endif %} - (1..num_loadbalancer).each do |nth| + {% if loadbalancers_specs is not none %} + (1..{{ num_loadbalancers }}).each do |nth| machine_id = "{{ customer_name }}-{{ env }}-lb%d" % [nth] machine_ip = increment_ip() @@ -53,8 +54,10 @@ Vagrant.configure("2") do |config| end end end + {% endif %} - (1..num_postgresql).each do |nth| + {% if postgres_specs is not none %} + (1..{{ num_postgres }}).each do |nth| machine_id = "{{ customer_name }}-{{ env }}-db%d" % [nth] machine_ip = increment_ip() @@ -73,4 +76,5 @@ Vagrant.configure("2") do |config| end end end + {% endif %} end