Only shows section in vagrantfile when applicable

This commit is contained in:
strNophix 2022-04-07 14:01:41 +02:00
parent a330bb17d1
commit 7ed3be574a

View File

@ -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