Commit e1e1f0bd authored by Alain Takoudjou's avatar Alain Takoudjou

kdbox: stabilize scripts

parent 110c5f11
...@@ -12,8 +12,10 @@ ...@@ -12,8 +12,10 @@
vars_prompt: vars_prompt:
- name: "re6sttoken" - name: "re6sttoken"
prompt: "\n\n You are running the KDBox Installer\n\n prompt: "\n\n You are running the KDBox Installer\n\n
Please request a re6stnet token on https://slapos.vifib.com. \n\n Please request a re6stnet token on https://slapos.vifib.com. \n\n
Enter your re6stnet token: " You will also need computer and account token, please get them on https://slapos.vifib.com. \n\n
A domain name will be required for kdbox slave frontend, to access erp5 later. \n\n
Enter your re6stnet token: "
private: no private: no
default: "notoken" default: "notoken"
......
--- ---
# get ERP5 URL will fail if erp5 instance is not ready
- name: Get ERP5 backend URL - name: Get ERP5 backend URL
shell: "{{ role_path }}/files/kdbox-param '{{ webrunner_instance_name }}' url" shell: "{{ role_path }}/files/kdbox-param '{{ webrunner_instance_name }}' url"
register: erp5_url register: erp5_url
...@@ -9,7 +10,7 @@ ...@@ -9,7 +10,7 @@
- name : requesting CDN slave instance for ERP5 - name : requesting CDN slave instance for ERP5
shell: echo "request('{{ frontend_software_release_url }}', '{{ custom_domain }}-slave',filter_kw={'computer_guid':'{{ computer_id }}'},partition_parameter_kw={'custom_domain':'{{ custom_domain }}','enable_cache':'true','type':'zope','url':'{{ erp5_url.stdout }}', 'path':'erp5/',},shared=True, software_type='custom-personal',)" | slapos console shell: echo "request('{{ frontend_software_release_url }}', '{{ custom_domain }}-slave',filter_kw={'computer_guid':'{{ computer_id }}'},partition_parameter_kw={'custom_domain':'{{ custom_domain }}','enable_cache':'true','type':'zope','url':'{{ erp5_url.stdout }}', 'path':'erp5/',},shared=True, software_type='custom-personal',)" | slapos console
when: supply_is_done == True and cert_folder.stat.exists == False when: cert_folder.stat.exists == False
register: request_slave register: request_slave
failed_when: "'error' in request_slave.stdout" failed_when: "'error' in request_slave.stdout"
......
...@@ -3,15 +3,21 @@ ...@@ -3,15 +3,21 @@
- stat: path=/opt/kdbox/frontend_requested - stat: path=/opt/kdbox/frontend_requested
register: frontend_requested register: frontend_requested
- stat: path=/opt/kdbox/frontend_supplied
register: frontend_supplied
- name: Caddy frontend supply - name: Caddy frontend supply
shell: slapos supply {{ frontend_software_release_url }} {{ computer_id }} shell: slapos supply {{ frontend_software_release_url }} {{ computer_id }}
when: slapos_cfg.stat.exists == True when: slapos_cfg.stat.exists == True and frontend_supplied.stat.exists == False
args:
creates: /opt/supply_check_file - name: Frontend is supplied
file: path=/opt/kdbox/frontend_supplied state=touch
- name: Requesting Caddy frontend istance - name: Requesting Caddy frontend instance
shell: echo "request('{{ frontend_software_release_url }}', '{{ frontend_instance_name }}', filter_kw={'computer_guid':'{{ computer_id}}'}, partition_parameter_kw={'-sla-1-computer_guid':'{{ computer_id }}','domain':'{{ domain_name }}','public-ipv4':'{{ ansible_default_ipv4.address }}',}, software_type='custom-personal',)" | slapos console shell: echo "request('{{ frontend_software_release_url }}', '{{ frontend_instance_name }}', filter_kw={'computer_guid':'{{ computer_id}}'}, partition_parameter_kw={'-sla-1-computer_guid':'{{ computer_id }}','domain':'{{ domain_name }}','public-ipv4':'{{ ansible_default_ipv4.address }}',}, software_type='custom-personal',)" | slapos console
when: supply_is_done == True and frontend_requested.stat.exists == False when: frontend_supplied.stat.exists == True and frontend_requested.stat.exists == False
register: output
failed_when: "'error' in output.stderr.lower()"
- name: Frontend is requested - name: Frontend is requested
file: path=/opt/kdbox/frontend_requested state=touch file: path=/opt/kdbox/frontend_requested state=touch
......
...@@ -2,10 +2,6 @@ ...@@ -2,10 +2,6 @@
- file: path=/opt/kdbox state=directory mode=0755 - file: path=/opt/kdbox state=directory mode=0755
- name: check if supply is done
stat: path=/opt/kdbox/supply_check_file
register: supply_check
- stat: path="/opt/kdbox/kdbox_ok" - stat: path="/opt/kdbox/kdbox_ok"
register: kdbox_is_ok register: kdbox_is_ok
...@@ -14,7 +10,6 @@ ...@@ -14,7 +10,6 @@
computer_id: "{{ lookup('ini','computer_id section=slapos file=/etc/opt/slapos/slapos.cfg') }}" computer_id: "{{ lookup('ini','computer_id section=slapos file=/etc/opt/slapos/slapos.cfg') }}"
domain_name: "{{ lookup('file', '/opt/kdbox/cdn_domain_name') }}" domain_name: "{{ lookup('file', '/opt/kdbox/cdn_domain_name') }}"
custom_domain: "{{ lookup('file', '/opt/kdbox/cdn_custom_domain') }}" custom_domain: "{{ lookup('file', '/opt/kdbox/cdn_custom_domain') }}"
supply_is_done: "{{ supply_check.stat.exists }}"
kdbox_ok: "{{ kdbox_is_ok.stat.exists }}" kdbox_ok: "{{ kdbox_is_ok.stat.exists }}"
- include: deploy.yml - include: deploy.yml
...@@ -32,12 +27,6 @@ ...@@ -32,12 +27,6 @@
- include: frontend.yml - include: frontend.yml
- include: frontend-slave-instance.yml - include: frontend-slave-instance.yml
# file created when software supply is done
- name: Software Release are supplied
file:
path: "/opt/kdbox/supply_check_file"
state: touch
# find Caddy ip to be used for port forwarding # find Caddy ip to be used for port forwarding
- name: Get Caddy local IP - name: Get Caddy local IP
shell: grep bind /srv/slapgrid/slappart*/etc/Caddyfile | cut -d ' ' -f4 | head -n1 shell: grep bind /srv/slapgrid/slappart*/etc/Caddyfile | cut -d ' ' -f4 | head -n1
......
...@@ -3,16 +3,22 @@ ...@@ -3,16 +3,22 @@
- stat: path=/opt/kdbox/webrunner_requested - stat: path=/opt/kdbox/webrunner_requested
register: webrunner_requested register: webrunner_requested
- stat: path=/opt/kdbox/webrunner_supplied
register: webrunner_supplied
- name: webrunner supply - name: webrunner supply
shell: slapos supply {{ webrunner_software_release_url }} {{ computer_id }} shell: slapos supply {{ webrunner_software_release_url }} {{ computer_id }}
when : slapos_cfg.stat.exists == True when : slapos_cfg.stat.exists == True and webrunner_supplied.stat.exists == False
args:
creates: /opt/kdbox/supply_check_file - name: Webrunner is supplied
file: path=/opt/kdbox/webrunner_supplied state=touch
- name: requesting webrunner instance - name: requesting webrunner instance
shell: echo "request('{{ webrunner_software_release_url }}', '{{ webrunner_instance_name }}', partition_parameter_kw={'-sla-runner0-computer_guid':'{{ computer_id }}','-sla-runner1-computer_guid':'{{ computer_id }}', 'auto-deploy':'true', 'auto-deploy-instance':'true', 'autorun':'true', 'slapos-software':'software/erp5',}, software_type='resilient',)" | slapos console shell: echo "request('{{ webrunner_software_release_url }}', '{{ webrunner_instance_name }}', partition_parameter_kw={'-sla-runner0-computer_guid':'{{ computer_id }}','-sla-runner1-computer_guid':'{{ computer_id }}', 'auto-deploy':'true', 'auto-deploy-instance':'true', 'autorun':'true', 'slapos-software':'software/erp5',}, software_type='resilient',)" | slapos console
when: supply_is_done == True and webrunner_requested.stat.exists == False when: webrunner_supplied.stat.exists == True and webrunner_requested.stat.exists == False
failed_when: "'error' in output.stderr.lower()"
register: output register: output
- name: webrunner is requested - name: webrunner is requested
file: path=/opt/kdbox/webrunner_requested state=touch file: path=/opt/kdbox/webrunner_requested state=touch
when: output is defined
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