Commit a6e9add6 authored by Rafael Monnerat's avatar Rafael Monnerat

Unify erp5-standalone and wendeling-standalone

parent 4c2d4f6e
......@@ -3,8 +3,10 @@
connection: local
vars:
software_release_url: https://lab.nexedi.cn/nexedi/slapos/raw/erp5-cluster-0.1/software/erp5/software.cfg
software_release_url: https://lab.nexedi.cn/nexedi/slapos/raw/erp5-cluster-0.1.1/software/erp5/software.cfg
startup_playbook_id: erp5-standalone.yml
playbook_name: erp5
request_instance_template: request-erp5-cluster.j2
roles:
- erp5-standalone
- standalone-shared
#!/bin/bash
# Reruns the ansible playbook, does nothing else
PLAYBOOK_ROOT=/opt/slapos.playbook/playbook/
PLAYBOOK_FILE=erp5-standalone.yml
cd $PLAYBOOK_ROOT # cd into the playbook directory
echo "Starting Ansible playbook:"
ansible-playbook $PLAYBOOK_FILE -i hosts --connection=local
---
- name: Supply erp5 software release
shell: slapos supply {{ software_release_url }} local_computer
- name: create partition script
copy: src=request-erp5-cluster dest=/tmp/playbook-request-erp5-cluster mode=700
template: src=request-instance.j2 dest=/tmp/playbook-request-erp5-cluster mode=700
- name: Request ERP5 Cluster
- name: Supply and Request ERP5 Cluster
shell: cat /tmp/playbook-request-erp5-cluster | slapos console
- name: Add startup script
copy: src=erp5-startup dest=/usr/local/bin/erp5-startup mode=755
- name: Add to rc.local
lineinfile:
dest=/etc/rc.local insertbefore=BOF
line='bash /usr/local/bin/erp5-startup &'
state=present
- name: Get slapos.playbook directory name
shell: cd /tmp/tmpplaybookerp5-standalone.*/slapos.playbook.git/playbook/; echo $(pwd)/
register: tmp_dir
- name: Check if /opt/slapos.playbook already exists
stat: path=/opt/slapos.playbook/
register: playbook_state
- name: Copy slapos.playbook
copy: src={{ tmp_dir.stdout }} dest=/opt/slapos.playbook/
when: playbook_state.stat.exists == False
---
- name: create partition script
template: src={{ request_instance_template }} dest=/tmp/playbook-request-{{ playbook_name }} mode=700
- name: Supply and Request ERP5 Cluster
shell: /tmp/playbook-request-{{ playbook_name }} | slapos console
- name: create erp5-show
copy: src=erp5-show dest=/usr/local/bin/erp5-show mode=755
- name: Add startup script
copy: src={{ playbook_name }}-startup dest=/usr/local/bin/{{ playbook_name }}-startup mode=755
- name: Add to rc.local
lineinfile:
dest=/etc/rc.local insertbefore=BOF
line='bash /usr/local/bin/{{ playbook_name }}-startup &'
state=present
- name: Get slapos.playbook directory name
shell: cd /tmp/tmpplaybookerp5-standalone.*/slapos.playbook.git/playbook/; echo $(pwd)/
register: tmp_dir
- name: Check if /opt/slapos.playbook already exists
stat: path=/opt/slapos.playbook/
register: playbook_state
- name: Copy slapos.playbook
copy: src={{ tmp_dir.stdout }} dest=/opt/slapos.playbook/
when: playbook_state.stat.exists == False
import json
software_url = 'https://lab.nexedi.cn/nexedi/slapos/raw/erp5-cluster-0.1/software/erp5/software.cfg'
software_url = '{{ software_release_url }}'
# Choose a SlapOS Node
# If you are deploying SlapOS Master with Webrunner, then computer_id is 'slaprunner'
computer_id = 'local_computer'
supply(software_url, computer_id)
parameter_dict = {
"timezone": "UTC",
"site-id": "erp5",
......@@ -33,7 +36,7 @@ parameter_dict = {
}
# Choose a title
title = "instance-of-erp5-cluster"
title = "instance-of-{{ playbook_name }}"
request(software_url,
title,
......
import json
# copied from the request-erp5-cluster script, only changed the url to point to wendelin
software_url = 'https://lab.nexedi.cn/nexedi/slapos/raw/1.0.2/software/wendelin/software.cfg'
# Choose a SlapOS Node
# If you are deploying SlapOS Master with Webrunner, then computer_id is 'slaprunner'
software_url = '{{ software_release_url }}'
computer_id = 'local_computer'
parameter_dict = {
}
# Choose a title
title = "instance-of-wendelin"
title = "instance-of-{{ playbook_name }}"
supply(software_url, computer_id)
request(software_url,
title,
......
#!/bin/bash
# Reruns the ansible playbook, does nothing else
cd /opt/slapos.playbook/playbook/
ansible-playbook {{ startup_playbook_id }} -i hosts --connection=local
#!/bin/bash
# Reruns the ansible playbook, does nothing else
PLAYBOOK_ROOT=/opt/slapos.playbook/
PLAYBOOK_FILE=wendelin-standalone.yml
cd $PLAYBOOK_ROOT # cd into the playbook directory
ansible-playbook $PLAYBOOK_FILE -i hosts --connection=local
---
- name: Supply wendelin software release
shell: slapos supply {{ software_release_url }} local_computer
- name: create partition script
copy: src=request-wendelin dest=/tmp/playbook-request-wendelin mode=700
- name: Request Wendelin instance
shell: cat /tmp/playbook-request-wendelin | slapos console
- name: Add startup script
copy: src=wendelin-startup dest=/usr/local/bin/wendelin-startup mode=755
- name: Add to rc.local
lineinfile:
dest=/etc/rc.local insertbefore=BOF
line='bash /usr/local/bin/wendelin-startup &'
state=present
- name: Get slapos.playbook directory name
shell: cd /tmp/tmpplaybookwendelin-standalone.*/slapos.playbook.git/playbook/; echo $(pwd)/
register: tmp_dir
- name: Check if /opt/slapos.playbook already exists
stat: path=/opt/slapos.playbook/
register: playbook_state
- name: Copy slapos.playbook
copy: src={{ tmp_dir.stdout }} dest=/opt/slapos.playbook/
when: playbook_state.stat.exists == False
......@@ -3,8 +3,10 @@
connection: local
vars:
software_release_url: https://lab.nexedi.cn/nexedi/slapos/raw/1.0.1/software/wendelin/software.cfg
software_release_url: https://lab.nexedi.cn/nexedi/slapos/raw/1.0.3/software/wendelin/software.cfg
startup_playbook_id: wendelin-standalone.yml
playbook_name: wendelin
request_instance_template: request-wendelin.j2
roles:
- wendelin-standalone
- standalone-shared
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