parent
02cca6b343
commit
e0bcc3ef3e
12 changed files with 118 additions and 98 deletions
@ -1,9 +1,28 @@ |
||||
--- |
||||
|
||||
- import_tasks: ../includes/webapps_archive.yml |
||||
vars: |
||||
- root_dir: "{{ etherpad_root_dir }}" |
||||
- version: "{{ current_version }}" |
||||
- db_name: "{{ etherpad_db_name }}" |
||||
- name: Create archive dir |
||||
file: path={{ etherpad_root_dir }}/archives/{{ etherpad_current_version }} state=directory mode=700 |
||||
tags: etherpad |
||||
|
||||
- name: Archive previous version |
||||
synchronize: |
||||
src: "{{ etherpad_root_dir }}/{{ etherpad_web_dir.stat.exists | ternary('web','app') }}" # previous versions were installed in the web subdir, now in app) |
||||
dest: "{{ etherpad_root_dir }}/archives/{{ etherpad_current_version }}/" |
||||
compress: False |
||||
delete: True |
||||
delegate_to: "{{ inventory_hostname }}" |
||||
tags: etherpad |
||||
|
||||
- name: Dump the database |
||||
mysql_db: |
||||
state: dump |
||||
name: "{{ etherpad_db_name }}" |
||||
target: "{{ etherpad_root_dir }}/archives/{{ etherpad_current_version }}/{{ etherpad_db_name }}.sql.xz" |
||||
login_host: "{{ etherpad_db_server | default(mysql_server) }}" |
||||
login_user: "{{ etherpad_db_user }}" |
||||
login_password: "{{ etherpad_db_pass }}" |
||||
quick: True |
||||
single_transaction: True |
||||
environment: |
||||
XZ_OPT: -T0 |
||||
tags: etherpad |
||||
|
@ -1,8 +1,10 @@ |
||||
--- |
||||
|
||||
- name: Remove temp files |
||||
file: path={{ etherpad_root_dir }}/tmp/{{ item }} state=absent |
||||
- name: Remove temp and obsolete files |
||||
file: path={{ etherpad_root_dir }}/{{ item }} state=absent |
||||
loop: |
||||
- etherpad-lite-{{ etherpad_version }} |
||||
- etherpad-lite-{{ etherpad_version }}.tar.gz |
||||
- tmp/etherpad-lite-{{ etherpad_version }} |
||||
- tmp/etherpad-lite-{{ etherpad_version }}.tar.gz |
||||
- web |
||||
- db_dumps |
||||
tags: etherpad |
||||
|
@ -1,44 +1,46 @@ |
||||
--- |
||||
|
||||
- import_tasks: ../includes/webapps_set_install_mode.yml |
||||
- block: |
||||
- import_tasks: ../includes/webapps_set_install_mode.yml |
||||
vars: |
||||
root_dir: "{{ etherpad_root_dir }}" |
||||
version: "{{ etherpad_version }}" |
||||
tags: etherpad |
||||
- set_fact: etherpad_install_mode={{ install_mode }} |
||||
- set_fact: etherpad_install_mode={{ install_mode }} |
||||
- set_fact: etherpad_current_version={{ current_version | default('') }} |
||||
tags: etherpad |
||||
|
||||
- import_tasks: ../includes/get_rand_pass.yml |
||||
- when: etherpad_db_pass is not defined |
||||
block: |
||||
- import_tasks: ../includes/get_rand_pass.yml |
||||
vars: |
||||
- pass_file: "{{etherpad_root_dir }}/meta/ansible_dbpass" |
||||
when: etherpad_db_pass is not defined |
||||
tags: etherpad |
||||
- set_fact: etherpad_db_pass={{ rand_pass }} |
||||
when: etherpad_db_pass is not defined |
||||
- set_fact: etherpad_db_pass={{ rand_pass }} |
||||
tags: etherpad |
||||
|
||||
- import_tasks: ../includes/get_rand_pass.yml |
||||
- block: |
||||
- import_tasks: ../includes/get_rand_pass.yml |
||||
vars: |
||||
- pass_file: "{{etherpad_root_dir }}/meta/ansible_session_key" |
||||
tags: etherpad |
||||
- set_fact: etherpad_session_key={{ rand_pass }} |
||||
- set_fact: etherpad_session_key={{ rand_pass }} |
||||
tags: etherpad |
||||
|
||||
- import_tasks: ../includes/get_rand_pass.yml |
||||
- when: etherpad_api_key is not defined |
||||
block: |
||||
- import_tasks: ../includes/get_rand_pass.yml |
||||
vars: |
||||
- pass_file: "{{etherpad_root_dir }}/meta/ansible_api_key" |
||||
when: etherpad_api_key is not defined |
||||
tags: etherpad |
||||
- set_fact: etherpad_api_key={{ rand_pass }} |
||||
when: etherpad_api_key is not defined |
||||
- set_fact: etherpad_api_key={{ rand_pass }} |
||||
tags: etherpad |
||||
|
||||
- import_tasks: ../includes/get_rand_pass.yml |
||||
- when: etherpad_admin_pass is not defined |
||||
block: |
||||
- import_tasks: ../includes/get_rand_pass.yml |
||||
vars: |
||||
- pass_file: "{{etherpad_root_dir }}/meta/ansible_admin_pass" |
||||
when: etherpad_admin_pass is not defined |
||||
tags: etherpad |
||||
- set_fact: etherpad_admin_pass={{ rand_pass }} |
||||
when: etherpad_admin_pass is not defined |
||||
- set_fact: etherpad_admin_pass={{ rand_pass }} |
||||
tags: etherpad |
||||
|
||||
- name: Check if web dir exists |
||||
stat: path={{ etherpad_root_dir }}/web |
||||
register: etherpad_web_dir |
||||
tags: etherpad |
||||
|
@ -1,7 +1,7 @@ |
||||
#!/bin/bash -e |
||||
|
||||
restorecon -R {{ etherpad_root_dir }} |
||||
chown -R {{ etherpad_user }}:{{ etherpad_user }} {{ etherpad_root_dir }}/web |
||||
find {{ etherpad_root_dir }}/web -type f -exec chmod 644 "{}" \; |
||||
find {{ etherpad_root_dir }}/web -type d -exec chmod 755 "{}" \; |
||||
chmod 640 {{ etherpad_root_dir }}/web/{settings.json,SESSIONKEY.txt,APIKEY.txt} |
||||
chown -R {{ etherpad_user }}:{{ etherpad_user }} {{ etherpad_root_dir }}/app |
||||
find {{ etherpad_root_dir }}/app -type f -exec chmod 644 "{}" \; |
||||
find {{ etherpad_root_dir }}/app -type d -exec chmod 755 "{}" \; |
||||
chmod 600 {{ etherpad_root_dir }}/app/{settings.json,SESSIONKEY.txt,APIKEY.txt} |
||||
|
@ -1,3 +1,3 @@ |
||||
#!/bin/sh |
||||
|
||||
rm -f {{ etherpad_root_dir }}/db_dumps/* |
||||
rm -f {{ etherpad_root_dir }}/backup/* |
||||
|
Loading…
Reference in new issue