From cfac25a51540354269098b864d369b25f543df40 Mon Sep 17 00:00:00 2001 From: Alexandre Iooss Date: Sun, 26 Jul 2020 22:48:36 +0200 Subject: [PATCH] Etherpad role --- base.yml | 1 + plays/etherpad.yml | 6 +++ roles/etherpad/tasks/main.yml | 43 +++++++++++++++++++ .../systemd/system/etherpad-lite.service.j2 | 17 ++++++++ .../templates/update-motd.d/05-service.j2 | 3 ++ 5 files changed, 70 insertions(+) create mode 100755 plays/etherpad.yml create mode 100644 roles/etherpad/tasks/main.yml create mode 100644 roles/etherpad/templates/systemd/system/etherpad-lite.service.j2 create mode 100755 roles/etherpad/templates/update-motd.d/05-service.j2 diff --git a/base.yml b/base.yml index d6a8243d..dc4daba9 100755 --- a/base.yml +++ b/base.yml @@ -81,4 +81,5 @@ - import_playbook: plays/wireguard.yml - import_playbook: plays/mirror.yml - import_playbook: plays/owncloud.yml +- import_playbook: plays/etherpad.yml - import_playbook: plays/reverse-proxy.yml diff --git a/plays/etherpad.yml b/plays/etherpad.yml new file mode 100755 index 00000000..8061bb70 --- /dev/null +++ b/plays/etherpad.yml @@ -0,0 +1,6 @@ +#!/usr/bin/env ansible-playbook +--- +# Deploy EtherPad +- hosts: kenobi.adm.crans.org + roles: + - etherpad diff --git a/roles/etherpad/tasks/main.yml b/roles/etherpad/tasks/main.yml new file mode 100644 index 00000000..4f227fe3 --- /dev/null +++ b/roles/etherpad/tasks/main.yml @@ -0,0 +1,43 @@ +--- +- name: Install Etherpad dependencies + apt: + update_cache: true + name: + - libssl-dev + - pkg-config + - build-essential + - nodejs + register: apt_result + retries: 3 + until: apt_result is succeeded + +- name: Clone EtherPad + git: + repo: https://github.com/ether/etherpad-lite.git + dest: /var/www/etherpad-lite + version: 1.8.4 + become: true + become_user: etherpad + +#- name: Configure EtherPad +# template: +# src: etherpad/settings.json.j2 +# dest: /var/www/etherpad-lite/settings.json + +- name: Install EtherPad systemd unit + template: + src: systemd/system/etherpad-lite.service.j2 + dest: /etc/systemd/system/etherpad-lite.service + +- name: Activate EtherPad service + systemd: + daemon_reload: true + name: etherpad + enabled: true + state: started + +- name: Indicate role in motd + template: + src: update-motd.d/05-service.j2 + dest: /etc/update-motd.d/05-etherpad + mode: 0755 diff --git a/roles/etherpad/templates/systemd/system/etherpad-lite.service.j2 b/roles/etherpad/templates/systemd/system/etherpad-lite.service.j2 new file mode 100644 index 00000000..96b02c03 --- /dev/null +++ b/roles/etherpad/templates/systemd/system/etherpad-lite.service.j2 @@ -0,0 +1,17 @@ +{{ ansible_header | comment }} + +[Unit] +Description=etherpad-lite (real-time collaborative document editing) +After=syslog.target network.target + +[Service] +Type=simple +User=etherpad +Group=etherpad +Environment=NODE_ENV=production +ExecStart=/var/www/etherpad-lite/bin/run.sh --stack-size=4096 +Restart=always +RestartSec=5s + +[Install] +WantedBy=multi-user.target diff --git a/roles/etherpad/templates/update-motd.d/05-service.j2 b/roles/etherpad/templates/update-motd.d/05-service.j2 new file mode 100755 index 00000000..a2704bdf --- /dev/null +++ b/roles/etherpad/templates/update-motd.d/05-service.j2 @@ -0,0 +1,3 @@ +#!/usr/bin/tail +14 +{{ ansible_header | comment }} +> EtherPad a été déployé sur cette machine. Voir /var/www/etherpad-lite/.