summaryrefslogtreecommitdiff
path: root/ansible/roles/etherpad
diff options
context:
space:
mode:
authorJoe Carstairs <me@joeac.net>2026-08-06 10:45:03 +0100
committerJoe Carstairs <me@joeac.net>2026-08-06 10:45:03 +0100
commit832f232972c65e7ebed62000aefe825cf8d8ff38 (patch)
tree5b378cffc7b985f2f2e9dd41ec188f9ddd994b60 /ansible/roles/etherpad
parent55100c1e0ffcd490b3e3257fe4e75296f4f32e62 (diff)
ansible-ise etherpad
Diffstat (limited to 'ansible/roles/etherpad')
-rw-r--r--ansible/roles/etherpad/tasks/main.yml65
-rw-r--r--ansible/roles/etherpad/templates/openrc/etherpad36
-rw-r--r--ansible/roles/etherpad/templates/settings.json134
3 files changed, 235 insertions, 0 deletions
diff --git a/ansible/roles/etherpad/tasks/main.yml b/ansible/roles/etherpad/tasks/main.yml
new file mode 100644
index 0000000..8709049
--- /dev/null
+++ b/ansible/roles/etherpad/tasks/main.yml
@@ -0,0 +1,65 @@
+- name: Install PNPM and Git
+ community.general.apk:
+ name:
+ - pnpm
+ - git
+
+- name: Install tsx globally
+ ansible.builtin.shell: pnpm install --global tsx
+ register: pnpm_install_tsx
+ changed_when: "'Already up to date' not in pnpm_install_tsx.stdout"
+ environment:
+ PNPM_HOME: "{{ ansible_facts.env.HOME }}/.local/share/pnpm"
+ PATH: "{{ ansible_facts.env.PATH }}:{{ ansible_facts.env.HOME }}/.local/share/pnpm"
+
+- name: Checkout source code for latest etherpad release
+ register: etherpad_src
+ ansible.builtin.git:
+ repo: https://github.com/ether/etherpad.git
+ dest: "{{ etherpad_src_dir }}"
+ depth: 1
+ version: master
+
+- name: Install etherpad settings
+ register: etherpad_settings
+ ansible.builtin.template:
+ src: settings.json
+ dest: "{{ etherpad_src_dir }}/settings.json"
+ mode: "640"
+
+- name: Install etherpad dependencies
+ register: etherpad_dependencies
+ changed_when: "'Already up to date' not in etherpad_dependencies.stdout"
+ ansible.builtin.command:
+ chdir: "{{ etherpad_src_dir }}"
+ cmd: pnpm install
+
+- name: Install etherpad service
+ register: etherpad_service
+ ansible.builtin.template:
+ src: openrc/etherpad
+ dest: /etc/init.d/etherpad
+ mode: "755"
+
+- name: Restart etherpad service and configure to start on boot
+ when:
+ etherpad_src is changed
+ or etherpad_service is changed
+ or etherpad_settings is changed
+ or etherpad_dependencies is changed
+ ansible.builtin.service:
+ name: etherpad
+ enabled: true
+ state: restarted
+
+- name: Start etherpad service and configure to start on boot
+ when:
+ not (
+ etherpad_src is changed
+ or etherpad_settings is changed
+ or etherpad_service is changed
+ or etherpad_dependencies is changed )
+ ansible.builtin.service:
+ name: etherpad
+ enabled: true
+ state: started
diff --git a/ansible/roles/etherpad/templates/openrc/etherpad b/ansible/roles/etherpad/templates/openrc/etherpad
new file mode 100644
index 0000000..5c31e4b
--- /dev/null
+++ b/ansible/roles/etherpad/templates/openrc/etherpad
@@ -0,0 +1,36 @@
+#!/sbin/openrc-run
+
+description="Run etherpad document server"
+
+start()
+{
+ ebegin "Starting etherpad"
+ start-stop-daemon --start \
+ --env NODE_ENV={{ etherpad_node_env }} \
+ --exec /usr/bin/pnpx \
+ --background \
+ --chdir {{ etherpad_src_dir }} \
+ --stdout /var/log/etherpad.log \
+ --stderr /var/log/etherpad.log \
+ --make-pidfile \
+ --pidfile /run/etherpad.pid \
+ -- tsx src/node/server.ts
+ eend $?
+}
+
+stop()
+{
+ ebegin "Stopping etherpad"
+ start-stop-daemon --stop \
+ --exec /usr/bin/pnpx \
+ --pidfile /run/etherpad.pid
+ eend $?
+}
+
+restart()
+{
+ ebegin "Restarting etherpad"
+ svc_stop
+ svc_start
+ eend $?
+}
diff --git a/ansible/roles/etherpad/templates/settings.json b/ansible/roles/etherpad/templates/settings.json
new file mode 100644
index 0000000..7818d93
--- /dev/null
+++ b/ansible/roles/etherpad/templates/settings.json
@@ -0,0 +1,134 @@
+{
+ "title": "joeac's docs",
+ "showRecentPads": true,
+ "favicon": null,
+ "skinName": "colibris",
+ "skinVariants": "super-light-toolbar super-light-editor light-background",
+ "ip": "0.0.0.0",
+ "port": {{ services.etherpad.port }},
+ "showSettingsInAdminPage": true,
+ "enableMetrics": "${ENABLE_METRICS:true}",
+ "cleanup": {
+ "enabled": false,
+ "keepRevisions": 5
+ },
+ "dbType": "sqlite",
+ "dbSettings": {
+ "filename": "var/sqlite.db"
+ },
+ "defaultPadText" : "",
+ "padOptions": {
+ "noColors": false,
+ "showControls": true,
+ "showChat": true,
+ "showLineNumbers": true,
+ "useMonospaceFont": false,
+ "userName": null,
+ "userColor": null,
+ "rtl": false,
+ "alwaysShowChat": false,
+ "chatAndUsers": false,
+ "lang": null
+ },
+ "padShortcutEnabled" : {
+ "altF9": true,
+ "altC": true,
+ "cmdShift2": true,
+ "delete": true,
+ "return": true,
+ "esc": true,
+ "cmdS": true,
+ "tab": true,
+ "cmdZ": true,
+ "cmdY": true,
+ "cmdI": true,
+ "cmdB": true,
+ "cmdU": true,
+ "cmd5": true,
+ "cmdShiftL": true,
+ "cmdShiftN": true,
+ "cmdShift1": true,
+ "cmdShiftC": true,
+ "cmdH": true,
+ "ctrlHome": true,
+ "pageUp": true,
+ "pageDown": true
+ },
+ "updateServer": "https://etherpad.org/ep_infos",
+ "suppressErrorsInPadText": false,
+ "requireSession": false,
+ "editOnly": false,
+ "minify": true,
+ "maxAge": 21600,
+ "soffice": null,
+ "docxExport": true,
+ "allowUnknownFileEnds": true,
+ "requireAuthentication": false,
+ "requireAuthorization": false,
+ "trustProxy": false,
+ "cookie": {
+ "keyRotationInterval": 86400000,
+ "sameSite": "Lax",
+ "sessionLifetime": 864000000,
+ "sessionRefreshInterval": 86400000,
+ "sessionCleanup": true
+ },
+ "disableIPlogging": false,
+ "automaticReconnectionTimeout": 0,
+ "scrollWhenFocusLineIsOutOfViewport": {
+ "percentage": {
+ "editionAboveViewport": 0,
+ "editionBelowViewport": 0
+ },
+ "duration": 0,
+ "scrollWhenCaretIsInTheLastLineOfViewport": false,
+ "percentageToScrollWhenUserPressesArrowUp": 0
+ },
+ "users": {
+ "admin": {
+ "password": "{{ etherpad_admin_password }}",
+ "is_admin": true
+ }
+ },
+ "socketTransportProtocols" : ["websocket", "polling"],
+ "socketIo": {
+ "maxHttpBufferSize": 1000000
+ },
+ "loadTest": false,
+ "dumpOnUncleanExit": false,
+ "importExportRateLimiting": {
+ "windowMs": 90000,
+ "max": 10
+ },
+ "importMaxFileSize": 52428800, // 50 * 1024 * 1024
+ "authenticationMethod": "${AUTHENTICATION_METHOD:sso}",
+ "enableDarkMode": "${ENABLE_DARK_MODE:true}",
+ "enablePadWideSettings": "${ENABLE_PAD_WIDE_SETTINGS:false}",
+ "commitRateLimiting": {
+ "duration": 1,
+ "points": 10
+ },
+ "logLayoutType": "colored",
+ "customLocaleStrings": {},
+ "enableAdminUITests": false,
+ "lowerCasePadIds": false,
+ "sso": {
+ "issuer": "${SSO_ISSUER:http://localhost:{{ services.etherpad.port }}}",
+ "clients": [
+ {
+ "client_id": "${ADMIN_CLIENT:admin_client}",
+ "client_secret": "${ADMIN_SECRET:admin}",
+ "grant_types": ["authorization_code"],
+ "response_types": ["code"],
+ "redirect_uris": ["${ADMIN_REDIRECT:http://localhost:{{ services.etherpad.port }}/admin/}"]
+ },
+ {
+ "client_id": "${USER_CLIENT:user_client}",
+ "client_secret": "${USER_SECRET:user}",
+ "grant_types": ["authorization_code"],
+ "response_types": ["code"],
+ "redirect_uris": ["${USER_REDIRECT:http://localhost:{{ services.etherpad.port }}/}"]
+ }
+ ]
+ }
+}