Commit a387f278 authored by Kasra Jamshidi's avatar Kasra Jamshidi

First try at apache-frontend play

parent d2e35b53
Pipeline #4239 skipped
- name: a play that runs entirely on the ansible host
hosts: 127.0.0.1
connection: local
vars:
software_release_url: https://lab.nexedi.com/kasra/slapos/raw/master/software/apache-frontend/software.cfg
startup_playbook_id: apache-frontend-cdn.yml
playbook_name: apache-frontend
request_instance_template: request-apache-frontend.j2
roles:
- apache-frontend
---
- name: create partition script
template: src={{ request_instance_template }} dest=/tmp/playbook-request-{{ playbook_name }} mode=700
- name: Supply and Request CDN
shell: cat /tmp/playbook-request-{{ playbook_name }} | slapos console
- name: Add startup script
template: src=start-script.j2 dest=/usr/local/bin/{{ playbook_name }}-startup mode=755
# - name: Include on reboot
# cron: name="Start Up script" special_time=reboot job="/usr/local/bin/{{ playbook_name }}-startup >> /var/log/{{ playbook_name }}-startup.log 2>&1"
- name: Get slapos.playbook directory name
shell: cd /tmp/tmpplaybookapache-frontend-cdn.*/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 = '{{ software_release_url }}'
computer_id = 'local_computer'
#supply(software_url, computer_id)
master_parameter_dict = {
"domain":"localhost:8080",
"public-ipv4":"127.0.0.1",
}
slave_parameter_dict = {
"url":"https://[::1]:8080/erp5",
"type":"zope",
}
# Choose a title
master_title = "instance-of-{{ playbook_name }}-master"
# request master
request(software_url,
master_title,
filter_kw={'computer_guid': computer_id},
software_type='default',
partition_parameter_kw={
'_': json.dumps(master_parameter_dict, sort_keys=True, indent=2),
}
)
slave_title = "instance-of-{{ playbook_name }}-slave"
# request slave
request(software_url,
slave_title,
software_type='RootSoftwareInstance',
shared=True,
partition_parameter_kw={
'_': json.dumps(parameter_dict, sort_keys=True, indent=2),
}
)
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