runnner: new parameter resilient-clone-number
[slapos.git] / software / slaprunner / instance-resilient.cfg.jinja2
1 # vim: set ft=cfg:
2
3 # Default parameters
4 # NOTE: in case of resilient instance, auto-deploy-instance
5 # set to false (else it could be dangerous)
6 {% do slapparameter_dict.__setitem__('auto-deploy', slapparameter_dict.get('auto-deploy', 'true')) %}
7 {% do slapparameter_dict.__setitem__('auto-deploy-instance', slapparameter_dict.get('auto-deploy-instance', 'false')) %}
8 # let decide the number of clones we want. We can't have more than 2 clones
9 {% set number_of_instances = slapparameter_dict.get('resilient-clone-number', 3)|int %}
10 {% if number_of_instances > 3 %}
11   {% set number_of_instances = 3 %}
12 {% endif %}
13
14 {% import 'parts' as parts %}
15 {% import 'replicated' as replicated %}
16
17 [buildout]
18 eggs-directory = {{ eggs_directory }}
19 develop-eggs-directory = {{ develop_eggs_directory }}
20 offline = true
21
22 # += because we need to take up parts (like instance-custom, slapmonitor etc) from the profile we extended
23 parts +=
24   {{ parts.replicate("runner", number_of_instances) }}
25   publish-connection-informations
26
27 {{ replicated.replicate("runner", number_of_instances, "runner-export", "runner-import", slapparameter_dict=slapparameter_dict) }}
28
29 # Bubble up the parameters
30 [request-runner]
31 return = url ssh-public-key ssh-url notification-id ip backend_url url ssh_command access_url 1_info 2_info monitor_url webdav_url public_url
32
33 [publish-connection-informations]
34 recipe = slapos.cookbook:publish
35 1_info = ${request-runner:connection-1_info}
36 2_info = ${request-runner:connection-2_info}
37 backend_url = ${request-runner:connection-backend_url}
38 access_url = ${request-runner:connection-access_url}
39 url = ${request-runner:connection-url}
40 ssh_command = ${request-runner:connection-ssh_command}
41 monitor_url = ${request-runner:connection-monitor_url}
42 webdav_url = ${request-runner:connection-webdav_url}
43 public_url = ${request-runner:connection-public_url}
44
45 [slap-parameter]
46 # Default parameters for distributed deployment
47 # I.e state "backup1 of maria should go there, ..."
48 # XXX-Cedric: Hardcoded number of backups. Should be dynamically generated.
49 {% for nb in range(1,number_of_instances+1) %}
50 runner{{nb}}-computer-guid =
51 pbs-runner{{nb}}-computer-guid =
52 {% endfor %}
53 # XXX-Cedric: Hardcoded parameters. Should be dynamically generated.
54 domain =
55 authorized-key =
56 instance-amount = 10
57 debug = false
58 resilient-clone-number = 3