Added cryptpad role
This commit is contained in:
3
roles/common/tasks/main.yml
Normal file
3
roles/common/tasks/main.yml
Normal file
@ -0,0 +1,3 @@
|
||||
---
|
||||
- include: web.yml
|
||||
- include: tools.yml
|
||||
10
roles/common/tasks/tools.yml
Normal file
10
roles/common/tasks/tools.yml
Normal file
@ -0,0 +1,10 @@
|
||||
---
|
||||
- name: use Node
|
||||
when: node_version is defined
|
||||
block:
|
||||
- name: check used version
|
||||
command: uberspace tools version show node
|
||||
register: used_node
|
||||
- name: update used version
|
||||
command: uberspace tools version use node {{ node_version }}
|
||||
when: used_node.stdout.find(node_version|string) == -1
|
||||
13
roles/common/tasks/web.yml
Normal file
13
roles/common/tasks/web.yml
Normal file
@ -0,0 +1,13 @@
|
||||
---
|
||||
- name: list domains
|
||||
command: uberspace web domain list
|
||||
register: domains
|
||||
- name: set up domain
|
||||
when: domains.stdout.find(domain) == -1
|
||||
block:
|
||||
- name: add domain
|
||||
command: uberspace web domain add {{ domain }}
|
||||
register: new_domain
|
||||
- name: print out important information
|
||||
debug:
|
||||
msg: "{{ new_domain.stdout }}"
|
||||
2
roles/cryptpad/defaults/main.yml
Normal file
2
roles/cryptpad/defaults/main.yml
Normal file
@ -0,0 +1,2 @@
|
||||
---
|
||||
cryptpad_version: 3.25.0
|
||||
3
roles/cryptpad/meta/main.yml
Normal file
3
roles/cryptpad/meta/main.yml
Normal file
@ -0,0 +1,3 @@
|
||||
---
|
||||
dependencies:
|
||||
- role: common
|
||||
24
roles/cryptpad/tasks/config.yml
Normal file
24
roles/cryptpad/tasks/config.yml
Normal file
@ -0,0 +1,24 @@
|
||||
---
|
||||
- name: copy config
|
||||
copy:
|
||||
remote_src: yes
|
||||
src: ~/cryptpad/config/config.example.js
|
||||
dest: ~/cryptpad/config/config.js
|
||||
- name: update config
|
||||
block:
|
||||
- name: set domain as safe origin
|
||||
lineinfile:
|
||||
path: ~/cryptpad/config/config.js
|
||||
regex: '/?/?httpSafeOrigin'
|
||||
line: "httpSafeOrigin: 'https://{{ domain }}',"
|
||||
- name: set http address
|
||||
lineinfile:
|
||||
path: ~/cryptpad/config/config.js
|
||||
regex: '/?/?httpAddress'
|
||||
line: "httpAddress: '::',"
|
||||
- name: change email address
|
||||
lineinfile:
|
||||
path: ~/cryptpad/config/config.js
|
||||
regex: 'adminEmail'
|
||||
line: 'adminEmail: {{ cryptpad_email }},'
|
||||
|
||||
8
roles/cryptpad/tasks/download.yml
Normal file
8
roles/cryptpad/tasks/download.yml
Normal file
@ -0,0 +1,8 @@
|
||||
---
|
||||
- name: download cryptpad
|
||||
git:
|
||||
dest: ~/cryptpad
|
||||
repo: https://github.com/xwiki-labs/cryptpad.git
|
||||
version: "{{ cryptpad_version }}"
|
||||
depth: 1
|
||||
accept_hostkey: yes
|
||||
11
roles/cryptpad/tasks/main.yml
Normal file
11
roles/cryptpad/tasks/main.yml
Normal file
@ -0,0 +1,11 @@
|
||||
---
|
||||
- include: download.yml
|
||||
- include: npm.yml
|
||||
- include: config.yml
|
||||
- include: service.yml
|
||||
- name: list web backends
|
||||
command: uberspace web backend list
|
||||
register: web_backends
|
||||
- name: set up web backend
|
||||
command: uberspace web backend set / --http --port 3000
|
||||
when: web_backends.stdout.find('http:3000') == -1
|
||||
12
roles/cryptpad/tasks/npm.yml
Normal file
12
roles/cryptpad/tasks/npm.yml
Normal file
@ -0,0 +1,12 @@
|
||||
---
|
||||
- name: install bower
|
||||
community.general.npm:
|
||||
name: bower
|
||||
global: yes
|
||||
- name: install npm dependencies
|
||||
community.general.npm:
|
||||
path: ~/cryptpad
|
||||
- name: install bower dependencies
|
||||
community.general.bower:
|
||||
path: ~/cryptpad
|
||||
relative_execpath: ~/lib/node_modules/bower/bin
|
||||
9
roles/cryptpad/tasks/service.yml
Normal file
9
roles/cryptpad/tasks/service.yml
Normal file
@ -0,0 +1,9 @@
|
||||
---
|
||||
- name: create service
|
||||
template:
|
||||
src: cryptpad_service.j2
|
||||
dest: ~/etc/services.d/cryptpad.ini
|
||||
mode: 0644
|
||||
notify:
|
||||
- reload supervisorctl
|
||||
- update supervisorctl
|
||||
6
roles/cryptpad/templates/cryptpad_service.j2
Normal file
6
roles/cryptpad/templates/cryptpad_service.j2
Normal file
@ -0,0 +1,6 @@
|
||||
[program:cryptpad]
|
||||
directory=%(ENV_HOME)s/cryptpad
|
||||
command=node server
|
||||
startsecs=60
|
||||
autorestart=yes
|
||||
|
||||
Reference in New Issue
Block a user