Commit a4ff1033 authored by Nicolas Wavrant's avatar Nicolas Wavrant

runnner: new parameter resilient-clone-number

parent ae0d786d
...@@ -80,7 +80,7 @@ mode = 0644 ...@@ -80,7 +80,7 @@ mode = 0644
[template-resilient] [template-resilient]
recipe = slapos.recipe.download recipe = slapos.recipe.download
url = ${:_profile_base_location_}/instance-resilient.cfg.jinja2 url = ${:_profile_base_location_}/instance-resilient.cfg.jinja2
md5sum = ab564b9a9de3e44884adf072fc740d23 md5sum = e185dae17a563dcb0779b78faff93bdc
filename = instance-resilient.cfg.jinja2 filename = instance-resilient.cfg.jinja2
mode = 0644 mode = 0644
......
...@@ -5,6 +5,11 @@ ...@@ -5,6 +5,11 @@
# set to false (else it could be dangerous) # set to false (else it could be dangerous)
{% do slapparameter_dict.__setitem__('auto-deploy', slapparameter_dict.get('auto-deploy', 'true')) %} {% do slapparameter_dict.__setitem__('auto-deploy', slapparameter_dict.get('auto-deploy', 'true')) %}
{% do slapparameter_dict.__setitem__('auto-deploy-instance', slapparameter_dict.get('auto-deploy-instance', 'false')) %} {% do slapparameter_dict.__setitem__('auto-deploy-instance', slapparameter_dict.get('auto-deploy-instance', 'false')) %}
# let decide the number of clones we want. We can't have more than 2 clones
{% set number_of_instances = slapparameter_dict.get('resilient-clone-number', 3)|int %}
{% if number_of_instances > 3 %}
{% set number_of_instances = 3 %}
{% endif %}
{% import 'parts' as parts %} {% import 'parts' as parts %}
{% import 'replicated' as replicated %} {% import 'replicated' as replicated %}
...@@ -16,10 +21,10 @@ offline = true ...@@ -16,10 +21,10 @@ offline = true
# += because we need to take up parts (like instance-custom, slapmonitor etc) from the profile we extended # += because we need to take up parts (like instance-custom, slapmonitor etc) from the profile we extended
parts += parts +=
{{ parts.replicate("runner", "3") }} {{ parts.replicate("runner", number_of_instances) }}
publish-connection-informations publish-connection-informations
{{ replicated.replicate("runner", "3", "runner-export", "runner-import", slapparameter_dict=slapparameter_dict) }} {{ replicated.replicate("runner", number_of_instances, "runner-export", "runner-import", slapparameter_dict=slapparameter_dict) }}
# Bubble up the parameters # Bubble up the parameters
[request-runner] [request-runner]
...@@ -41,14 +46,13 @@ public_url = ${request-runner:connection-public_url} ...@@ -41,14 +46,13 @@ public_url = ${request-runner:connection-public_url}
# Default parameters for distributed deployment # Default parameters for distributed deployment
# I.e state "backup1 of maria should go there, ..." # I.e state "backup1 of maria should go there, ..."
# XXX-Cedric: Hardcoded number of backups. Should be dynamically generated. # XXX-Cedric: Hardcoded number of backups. Should be dynamically generated.
runner1-computer-guid = {% for nb in range(1,number_of_instances+1) %}
pbs-runner1-computer-guid = runner{{nb}}-computer-guid =
runner2-computer-guid = pbs-runner{{nb}}-computer-guid =
pbs-runner2-computer-guid = {% endfor %}
runner3-computer-guid =
pbs-runner3-computer-guid =
# XXX-Cedric: Hardcoded parameters. Should be dynamically generated. # XXX-Cedric: Hardcoded parameters. Should be dynamically generated.
domain = domain =
authorized-key = authorized-key =
instance-amount = 10 instance-amount = 10
debug = false debug = false
resilient-clone-number = 3
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment