parent
87726b405c
commit
7f910f8ffc
13 changed files with 142 additions and 0 deletions
@ -0,0 +1,24 @@ |
||||
--- |
||||
|
||||
# Version to deploy |
||||
synadm_version: 0.8.3 |
||||
# URL of the tarball |
||||
synadm_archive_url: https://github.com/Awesome-Technologies/synapse-admin/releases/download/{{ synadm_version }}/synapse-admin-{{ synadm_version }}.tar.gz |
||||
# Expected sha1 of the archive |
||||
synadm_archive_sha1: f74676ec618b664d2409032d10c15c1f310222fc |
||||
|
||||
# Shoulad ansible handle upgrades, or just initial install ? |
||||
synadm_manage_upgrade: True |
||||
|
||||
# Root dir where synadm will be installed |
||||
synadm_root_dir: /opt/matrix/synapse_admin |
||||
|
||||
# Should a web alilas be created, eg set it to synadm to access it from https://yourserver/synadm |
||||
# If an alias is not defined (or set to False), you'll have to create a virtualhost pointing at {{ synadm_root_dir }}/web |
||||
synadm_web_alias: synadm |
||||
|
||||
# Optional list of allowed IP address. If undefined, everyone can access it |
||||
# synadm_src_ip: |
||||
# - 12.13.14.15 |
||||
# - 16.17.18.19 |
||||
|
@ -0,0 +1,4 @@ |
||||
--- |
||||
|
||||
dependencies: |
||||
- role: httpd_common |
@ -0,0 +1,7 @@ |
||||
--- |
||||
|
||||
- import_tasks: ../includes/webapps_compress_archive.yml |
||||
vars: |
||||
- root_dir: "{{ synadm_root_dir }}" |
||||
- version: "{{ synadm_current_version }}" |
||||
tags: matrix |
@ -0,0 +1,7 @@ |
||||
--- |
||||
|
||||
- import_tasks: ../includes/webapps_archive.yml |
||||
vars: |
||||
- root_dir: "{{ synadm_root_dir }}" |
||||
- version: "{{ synadm_current_version }}" |
||||
tags: matrix |
@ -0,0 +1,9 @@ |
||||
--- |
||||
|
||||
- name: Remove temp files |
||||
file: path={{ synadm_root_dir }}/tmp/{{ item }} state=absent |
||||
loop: |
||||
- synapse-admin-{{ synadm_version }}.tar.gz |
||||
- synapse-admin-{{ synadm_version }} |
||||
tags: matrix |
||||
|
@ -0,0 +1,6 @@ |
||||
--- |
||||
|
||||
- name: Deploy httpd configuration |
||||
template: src=httpd.conf.j2 dest=/etc/httpd/ansible_conf.d/10-synadm.conf |
||||
notify: reload httpd |
||||
tags: matrix |
@ -0,0 +1,12 @@ |
||||
--- |
||||
|
||||
- name: Create directory structure |
||||
file: path={{ synadm_root_dir }}/{{ item.dir }} state=directory owner={{ item.owner | default(omit) }} group={{ item.group | default(omit) }} mode={{ item.mode | default(omit) }} |
||||
with_items: |
||||
- dir: tmp |
||||
- dir: archives |
||||
mode: 700 |
||||
- dir: meta |
||||
mode: 700 |
||||
- dir: web |
||||
tags: matrix |
@ -0,0 +1,10 @@ |
||||
--- |
||||
|
||||
- block: |
||||
- import_tasks: ../includes/webapps_set_install_mode.yml |
||||
vars: |
||||
- root_dir: "{{ synadm_root_dir }}" |
||||
- version: "{{ synadm_version }}" |
||||
- set_fact: synadm_install_mode={{ (install_mode == 'upgrade' and not synadm_manage_upgrade) | ternary('none',install_mode) }} |
||||
- set_fact: synadm_current_version={{ current_version | default('') }} |
||||
tags: matrix |
@ -0,0 +1,24 @@ |
||||
--- |
||||
|
||||
- when: synadm_install_mode != 'none' |
||||
block: |
||||
- name: Download Synapse Admin |
||||
get_url: |
||||
url: "{{ synadm_archive_url }}" |
||||
dest: "{{ synadm_root_dir }}/tmp/" |
||||
checksum: "sha1:{{ synadm_archive_sha1 }}" |
||||
|
||||
- name: Extract archive |
||||
unarchive: |
||||
src: "{{ synadm_root_dir }}/tmp/synapse-admin-{{ synadm_version }}.tar.gz" |
||||
dest: "{{ synadm_root_dir }}/tmp/" |
||||
remote_src: True |
||||
|
||||
- name: Move the content to the final top directory |
||||
synchronize: |
||||
src: "{{ synadm_root_dir }}/tmp/synapse-admin-{{ synadm_version }}/" |
||||
dest: "{{ synadm_root_dir }}/web/" |
||||
recursive: True |
||||
delete: True |
||||
delegate_to: "{{ inventory_hostname }}" |
||||
tags: matrix |
@ -0,0 +1,13 @@ |
||||
--- |
||||
|
||||
- include: directories.yml |
||||
- include: facts.yml |
||||
- include: archive_pre.yml |
||||
when: synadm_install_mode == 'upgrade' |
||||
- include: install.yml |
||||
- include: conf.yml |
||||
- include: archive_post.yml |
||||
when: synadm_install_mode == 'upgrade' |
||||
- include: write_version.yml |
||||
- include: cleanup.yml |
||||
|
@ -0,0 +1,7 @@ |
||||
--- |
||||
|
||||
- import_tasks: ../includes/webapps_post.yml |
||||
vars: |
||||
- root_dir: "{{ synadm_root_dir }}" |
||||
- version: "{{ synadm_version }}" |
||||
tags: matrix |
@ -0,0 +1,14 @@ |
||||
{% if synadm_web_alias is defined and synadm_web_alias != False %} |
||||
Alias /{{ synadm_web_alias }} {{ synadm_root_dir }}/web |
||||
{% else %} |
||||
# No alias defined, create a vhost to access it |
||||
{% endif %} |
||||
<Directory {{ synadm_root_dir }}/web> |
||||
AllowOverride None |
||||
Options None |
||||
{% if synadm_src_ip is defined %} |
||||
Require ip {{ synadm_src_ip | join(' ') }} |
||||
{% else %} |
||||
Require all granted |
||||
{% endif %} |
||||
</Directory> |
@ -0,0 +1,5 @@ |
||||
#!/bin/sh |
||||
|
||||
chown -R root:root {{ synadm_root_dir }} |
||||
find {{ synadm_root_dir }}/web -type f -exec chmod 644 "{}" \; |
||||
find {{ synadm_root_dir }}/web -type d -exec chmod 755 "{}" \; |
Loading…
Reference in new issue