pad
This commit is contained in:
parent
980ec6c4f6
commit
d0c1e45196
2 changed files with 125 additions and 120 deletions
|
@ -47,6 +47,7 @@
|
||||||
- hosts: pad
|
- hosts: pad
|
||||||
roles:
|
roles:
|
||||||
- { role: "acme", tags: [ "acme" ] }
|
- { role: "acme", tags: [ "acme" ] }
|
||||||
|
- { role: "nginx", tags: [ "nginx" ] }
|
||||||
- { role: "etherpad", tags: [ "etherpad" ] }
|
- { role: "etherpad", tags: [ "etherpad" ] }
|
||||||
|
|
||||||
- hosts: services
|
- hosts: services
|
||||||
|
|
|
@ -1,11 +1,15 @@
|
||||||
---
|
---
|
||||||
- tags: etherpad
|
|
||||||
block:
|
|
||||||
- name: Install dependencies
|
|
||||||
ansible.builtin.apt:
|
|
||||||
name: [ gpg, postgresql, python3-psycopg2, apt-transport-https ]
|
|
||||||
|
|
||||||
- name: Import nodesource signing key
|
- name: Install dependencies
|
||||||
|
ansible.builtin.apt:
|
||||||
|
state: present
|
||||||
|
pkg:
|
||||||
|
- gpg
|
||||||
|
- postgresql
|
||||||
|
- python3-psycopg2
|
||||||
|
- apt-transport-https
|
||||||
|
|
||||||
|
- name: Import nodesource signing key
|
||||||
ansible.builtin.shell:
|
ansible.builtin.shell:
|
||||||
cmd: curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor
|
cmd: curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor
|
||||||
-o /usr/share/keyrings/nodesource.gpg
|
-o /usr/share/keyrings/nodesource.gpg
|
||||||
|
@ -13,7 +17,7 @@
|
||||||
creates: /usr/share/keyrings/nodesource.gpg
|
creates: /usr/share/keyrings/nodesource.gpg
|
||||||
notify: apt update
|
notify: apt update
|
||||||
|
|
||||||
- name: Install nodesource source list
|
- name: Install nodesource source list
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: nodesource.list
|
src: nodesource.list
|
||||||
dest: /etc/apt/sources.list.d/nodesource.list
|
dest: /etc/apt/sources.list.d/nodesource.list
|
||||||
|
@ -22,7 +26,7 @@
|
||||||
mode: 0644
|
mode: 0644
|
||||||
notify: apt update
|
notify: apt update
|
||||||
|
|
||||||
- name: Install nodejs apt preference
|
- name: Install nodejs apt preference
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: nodejs-apt-pref
|
src: nodejs-apt-pref
|
||||||
dest: /etc/apt/preferences.d/nodejs
|
dest: /etc/apt/preferences.d/nodejs
|
||||||
|
@ -31,13 +35,13 @@
|
||||||
mode: 0644
|
mode: 0644
|
||||||
notify: apt update
|
notify: apt update
|
||||||
|
|
||||||
- ansible.builtin.meta: flush_handlers
|
- ansible.builtin.meta: flush_handlers
|
||||||
|
|
||||||
- name: Install nodejs
|
- name: Install nodejs
|
||||||
ansible.builtin.apt:
|
ansible.builtin.apt:
|
||||||
name: nodejs
|
name: nodejs
|
||||||
|
|
||||||
- name: Add database user
|
- name: Add database user
|
||||||
become: true
|
become: true
|
||||||
become_method: su
|
become_method: su
|
||||||
become_user: postgres
|
become_user: postgres
|
||||||
|
@ -46,7 +50,7 @@
|
||||||
name: etherpad
|
name: etherpad
|
||||||
password: "{{ etherpad_db_password }}"
|
password: "{{ etherpad_db_password }}"
|
||||||
|
|
||||||
- name: Add database
|
- name: Add database
|
||||||
become: true
|
become: true
|
||||||
become_method: su
|
become_method: su
|
||||||
become_user: postgres
|
become_user: postgres
|
||||||
|
@ -54,12 +58,12 @@
|
||||||
name: "{{ etherpad_db_name }}"
|
name: "{{ etherpad_db_name }}"
|
||||||
owner: "{{ etherpad_db_user }}"
|
owner: "{{ etherpad_db_user }}"
|
||||||
|
|
||||||
- name: Add etherpad user
|
- name: Add etherpad user
|
||||||
ansible.builtin.user:
|
ansible.builtin.user:
|
||||||
name: etherpad
|
name: etherpad
|
||||||
home: /var/lib/etherpad
|
home: /var/lib/etherpad
|
||||||
|
|
||||||
- name: Create log file
|
- name: Create log file
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
path: /var/log/etherpad.log
|
path: /var/log/etherpad.log
|
||||||
state: touch
|
state: touch
|
||||||
|
@ -67,7 +71,7 @@
|
||||||
group: etherpad
|
group: etherpad
|
||||||
mode: 0644
|
mode: 0644
|
||||||
|
|
||||||
- name: Create source directory
|
- name: Create source directory
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
path: /opt/etherpad
|
path: /opt/etherpad
|
||||||
state: directory
|
state: directory
|
||||||
|
@ -75,7 +79,7 @@
|
||||||
group: etherpad
|
group: etherpad
|
||||||
mode: 0755
|
mode: 0755
|
||||||
|
|
||||||
- name: Clone etherpad source
|
- name: Clone etherpad source
|
||||||
become: yes
|
become: yes
|
||||||
become_method: su
|
become_method: su
|
||||||
become_user: etherpad
|
become_user: etherpad
|
||||||
|
@ -86,7 +90,7 @@
|
||||||
accept_hostkey: yes
|
accept_hostkey: yes
|
||||||
notify: restart etherpad
|
notify: restart etherpad
|
||||||
|
|
||||||
- name: Install etherpad config
|
- name: Install etherpad config
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: settings.json
|
src: settings.json
|
||||||
dest: /opt/etherpad/settings.json
|
dest: /opt/etherpad/settings.json
|
||||||
|
@ -95,7 +99,7 @@
|
||||||
mode: 0644
|
mode: 0644
|
||||||
notify: restart etherpad
|
notify: restart etherpad
|
||||||
|
|
||||||
- name: Install etherpad service
|
- name: Install etherpad service
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: etherpad.service
|
src: etherpad.service
|
||||||
dest: /etc/systemd/system/etherpad.service
|
dest: /etc/systemd/system/etherpad.service
|
||||||
|
@ -104,14 +108,14 @@
|
||||||
mode: 0644
|
mode: 0644
|
||||||
notify: restart etherpad
|
notify: restart etherpad
|
||||||
|
|
||||||
- name: Start etherpad
|
- name: Start etherpad
|
||||||
ansible.builtin.systemd:
|
ansible.builtin.systemd:
|
||||||
daemon_reload: true
|
daemon_reload: true
|
||||||
name: etherpad
|
name: etherpad
|
||||||
state: started
|
state: started
|
||||||
enabled: yes
|
enabled: yes
|
||||||
|
|
||||||
- name: Install nginx config
|
- name: Install nginx config
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: nginx-site.conf
|
src: nginx-site.conf
|
||||||
dest: /etc/nginx/sites-enabled/etherpad
|
dest: /etc/nginx/sites-enabled/etherpad
|
||||||
|
@ -120,7 +124,7 @@
|
||||||
mode: 0644
|
mode: 0644
|
||||||
notify: reload nginx
|
notify: reload nginx
|
||||||
|
|
||||||
- name: Allow HTTP and HTTPS
|
- name: Allow HTTP and HTTPS
|
||||||
ansible.builtin.iptables:
|
ansible.builtin.iptables:
|
||||||
chain: INPUT
|
chain: INPUT
|
||||||
protocol: tcp
|
protocol: tcp
|
||||||
|
|
Loading…
Add table
Reference in a new issue