Commit 454e88c2 authored by Rafael Monnerat's avatar Rafael Monnerat

Automate SlapOS master Installation.

/reviewed-on !36
parent 8f6fe0be
computer_id = 'local_computer'
frontend_software_release_url = '{{ frontend_software_release_url }}'
supply(frontend_software_release_url, computer_id)
# frontend master partition
request(software_release=frontend_software_release_url, partition_reference='{{ frontend_master_reference }}')
# frontend slave partition
backend_url = None
try:
backend_url = open('{{ backend_url_path }}', 'r').read()
except Exception:
pass
if backend_url is not None:
request(
software_release=frontend_software_release_url,
partition_reference='{{ frontend_slave_reference }}',
shared=True,
partition_parameter_kw={
'url': backend_url,
'type': 'zope',
'custom_domain': '{{ ansible_default_ipv4.address }}',
'server-alias': '*',
'https-only': 'true'
}
)
import json
import json
software_url = '{{ software_release_url }}'
# Choose a SlapOS Node
......@@ -10,16 +10,20 @@ supply(software_url, computer_id)
parameter_dict = {
"timezone": "UTC",
"site-id": "erp5",
"bt5": "erp5_full_text_myisam_catalog slapos_configurator",
"developer-list": ["zope"],
"inituser-login": "zope",
"inituser-password": "insecure",
"bt5": "{{ bt5_list }}",
"zope-partition-dict": {
"admin": {
"family": "admin",
"thread-amount": 4,
"port-base": 2220,
"instance-count": 1
},
"activities-node": {
"family": "activities",
"thread-amount": 3,
"thread-amount": 4,
"instance-count": 1,
"timerserver-interval": 1
"timerserver-interval": 1,
"port-base": 2230
},
"distribution-node": {
"family": "distribution",
......@@ -28,31 +32,21 @@ parameter_dict = {
"port-base": 2210,
"timerserver-interval": 1
},
"admin-node": {
"family": "admin",
"thread-amount": 1,
"instance-count": 1,
"port-base": 2220
},
"web-node": {
"family": "web",
"thread-amount": 2,
"instance-count": 1,
"port-base": 2230
"port-base": 2240
},
"service-slapos": {
"family": "service",
"thread-amount": 2,
"instance-count": 1,
"port-base": 2240,
"port-base": 2250,
"ssl-authentication": True,
"backend-path": "/%(site-id)s/portal_slap"
}
},
"mariadb": {
"test-database-amount": 0
},
"zodb-software-type": "zeo"
}
}
ca_path = '/etc/slapos-ssl'
......@@ -61,11 +55,17 @@ parameter_dict["shared-certificate-authority-path"] = ca_path
# Choose a title
title = "instance-of-{{ playbook_name }}"
request(software_url,
erp5_instance = request(software_url,
title,
filter_kw={'computer_guid': computer_id},
software_type='create-erp5-site',
software_type='default',
partition_parameter_kw={
'_': json.dumps(parameter_dict, sort_keys=True, indent=2),
}
)
).getConnectionParameterDict()
if '_' in erp5_instance:
backend_dict = json.loads(erp5_instance['_'])
if 'family-admin-v6' in backend_dict:
backend_url = str(backend_dict['family-admin-v6'])
open('{{ backend_url_path }}', 'w').write(backend_url)
......@@ -3,7 +3,8 @@
connection: local
vars:
software_release_url: https://lab.node.vifib.com/nexedi/slapos/raw/1.0.21/software/slapos-master/software.cfg
software_release_url: https://lab.node.vifib.com/nexedi/slapos/raw/1.0.56/software/slapos-master/software.cfg
bt5_list: erp5_full_text_myisam_catalog slapos_configurator
startup_playbook_id: slapos-master-standalone.yml
playbook_name: slapos-master
request_instance_template: request-slapos-master.j2
......
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