diff --git a/.ansible-lint b/.ansible-lint new file mode 100644 index 0000000..d54bee6 --- /dev/null +++ b/.ansible-lint @@ -0,0 +1,6 @@ +skip_list: + - fqcn-builtins + - fqcn[action] + - fqcn[action-core] + - fqcn[canonical] + - name[casing] diff --git a/defaults/main.yml b/defaults/main.yml index 33d3469..a197dd5 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,15 +1,15 @@ --- -etherpad_version: '2.2.5' +etherpad_version: '2.2.6' etherpad_skin: 'colibris' -etherpad_skinVariants: 'super-light-toolbar super-light-editor light-background' +etherpad_skin_variants: 'super-light-toolbar super-light-editor light-background' etherpad_username: 'etherpad' etherpad_group: 'etherpad' etherpad_app_dir: '/var/www/etherpad-lite' etherpad_instance_name: 'pads' etherpad_listen_ip: '0.0.0.0' etherpad_listen_port: '9001' -etherpad_db_type: '0' #an integer. 0 or unset for mysql, 1 for postgres +etherpad_db_type: '0' # an integer. 0 or unset for mysql, 1 for postgres etherpad_db_user: 'etherpad' etherpad_db_host: 'localhost' etherpad_db_passwd: 'changeme' @@ -19,33 +19,36 @@ etherpad_welcome_text: 'Welcome to Etherpad!\n\nThis pad text is synchronized as etherpad_group_only: 'false' etherpad_editonly: 'false' etherpad_minify: 'true' -etherpad_showSettingsInAdminPage: 'true' -etherpad_suppressErrorsInPadText: 'false' -etherpad_allowUnknownFileEnds: 'true' -etherpad_automaticReconnectionTimeout: '0' -etherpad_indentationOnNewLine: 'false' -etherpad_importExportRateLimitingwindowMs: '90000' -etherpad_importExportRateLimitingMax: '10' -etherpad_importMaxFileSize: '52428800' # 50 MB -> 50 * 1024 * 1024 +etherpad_show_settings_in_admin_page: 'true' +etherpad_cleanup_enabled: 'false' +etherpad_cleanup_keep_revisions: '5' +etherpad_suppress_errors_in_pad_text: 'false' +etherpad_allow_unknown_file_ends: 'true' +etherpad_automatic_reconnection_timeout: '0' +etherpad_indentation_on_new_line: 'false' +etherpad_import_export_rate_limiting_window_ms: '90000' +etherpad_import_export_rate_limiting_max: '10' +etherpad_import_max_file_size: '52428800' # 50 MB -> 50 * 1024 * 1024 etherpad_authmethod: 'sso' -etherpad_exposeVersion: 'false' +etherpad_expose_version: 'false' etherpad_js_maxage: '21600' etherpad_max_log_size: '1024' etherpad_abiword: '/usr/bin/abiword' etherpad_auth: 'false' etherpad_authorization: 'false' etherpad_proxy: 'false' -etherpad_sessionLifetime: '864000000' #10d -etherpad_sessionRefreshInterval: '86400000' #1d +etherpad_session_lifetime: '864000000' # 10 days +etherpad_session_refresh_interval: '86400000' # 1 day etherpad_ip_logging: 'false' -etherpad_maxHttpBufferSize: '10000' -etherpad_enableAdminUITests: 'false' +etherpad_max_http_buffer_size: '10000' +etherpad_log_layout_type: 'colored' +etherpad_enable_admin_ui_tests: 'false' etherpad_admin_pwd: 'changeme' etherpad_ratelimit_duration: '1' etherpad_ratelimit_points: '100' etherpad_loglevel: 'INFO' etherpad_logfile: '/var/log/etherpad-lite.log' -etherpad_dumpOnUncleanExit: 'false' +etherpad_dump_on_unclean_exit: 'false' etherpad_error_log_recipient: 'support@example.com' etherpad_smtp_host: 'localhost' etherpad_smtp_port: '587' @@ -59,7 +62,6 @@ etherpad_apt: nodejs_version: '21' etherpad_admin_page: 'true' # set to something else if you don't want to build admin page - etherpad_plugins_list: # set to "removed" if you want to remove à plugin ep_adminpads2: enabled ep_comments_page: enabled @@ -81,11 +83,11 @@ etherpad_plugins_list: # set to "removed" if you want to remove à plugin # ep_delete_after_delay # Etherpad-Lite plugin that deletes your pads after a configured delay -delay: '7776000' # one day, in seconds Default is 86400 -loopdeletion: 'true' -loopDelay: '86400' # one hour, in seconds Default is 3600 -deleteAtStart: 'true' -text: "The content of this pad has been deleted since it was older than the configured delay." +ep_delafter_delay: '7776000' # one day, in seconds Default is 86400 +ep_delafter_loopdeletion: 'true' +ep_delafter_loopdelay: '86400' # one hour, in seconds Default is 3600 +ep_delafter_delete_at_start: 'true' +ep_delafter_text: "The content of this pad has been deleted since it was older than the configured delay." # MARIADB CONFIG mariadb_databases: diff --git a/handlers/main.yml b/handlers/main.yml index 1de49bd..6bd6fb7 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -1,6 +1,6 @@ --- -- name: restart etherpad +- name: 'Restart etherpad' systemd: - name: etherpad - state: restarted + name: 'etherpad' + state: 'restarted' diff --git a/tasks/abiword.yml b/tasks/abiword.yml index f21f547..9b39906 100644 --- a/tasks/abiword.yml +++ b/tasks/abiword.yml @@ -2,6 +2,6 @@ - name: '[LIBRE-OFFICE] - Install Abiword' apt: - name: abiword - state: present - update_cache: yes + name: 'abiword' + state: 'present' + update_cache: true diff --git a/tasks/configure.yml b/tasks/configure.yml index 8f7d227..9006396 100644 --- a/tasks/configure.yml +++ b/tasks/configure.yml @@ -2,20 +2,22 @@ - name: '[CONFIGURE] - Create log file' file: - path: "{{ etherpad_logfile }}" - state: touch - owner: "{{ etherpad_username }}" - group: "{{ etherpad_group }}" - mode: 0755 - tags: config + path: '{{ etherpad_logfile }}' + state: 'touch' + owner: '{{ etherpad_username }}' + group: '{{ etherpad_group }}' + mode: '0755' + tags: + - 'config' - name: '[CONFIGURE] - Deploy config' template: - src: var/www/etherpad-lite/settings.json.j2 - dest: "{{ etherpad_app_dir }}/app/settings.json" - owner: "{{ etherpad_username }}" - group: "{{ etherpad_group }}" - mode: 0644 + src: 'var/www/etherpad-lite/settings.json.j2' + dest: '{{ etherpad_app_dir }}/app/settings.json' + owner: '{{ etherpad_username }}' + group: '{{ etherpad_group }}' + mode: '0644' notify: - restart etherpad - tags: config + - 'Restart etherpad' + tags: + - 'config' diff --git a/tasks/git.yml b/tasks/git.yml index 2f06330..956b585 100644 --- a/tasks/git.yml +++ b/tasks/git.yml @@ -2,19 +2,20 @@ - name: '[GIT] - Create directory' file: - path: "/var/www/" - state: directory - owner: "{{ etherpad_username }}" - group: "{{ etherpad_group }}" - mode: 0755 + path: '/var/www/' + state: 'directory' + owner: '{{ etherpad_username }}' + group: '{{ etherpad_group }}' + mode: '0755' - name: '[GIT] - Deploy source' git: - repo: https://github.com/ether/etherpad-lite.git - dest: "{{ etherpad_app_dir }}/app" - force: yes - update: yes - version: "{{ etherpad_version }}" + repo: 'https://github.com/ether/etherpad-lite.git' + dest: '{{ etherpad_app_dir }}/app' + force: true + update: true + version: '{{ etherpad_version }}' become: true - become_user: "{{ etherpad_username }}" - notify: restart etherpad + become_user: '{{ etherpad_username }}' + notify: + - 'Restart etherpad' diff --git a/tasks/install.yml b/tasks/install.yml index c7fb44c..2f1fe04 100644 --- a/tasks/install.yml +++ b/tasks/install.yml @@ -1,18 +1,18 @@ --- - name: '[INSTALL] - Install with pnpm' - shell: - cmd: pnpm install + command: + cmd: 'pnpm install' args: - chdir: "{{ etherpad_app_dir }}/app" - become: yes - become_user: "{{ etherpad_username }}" + chdir: '{{ etherpad_app_dir }}/app' + become: true + become_user: '{{ etherpad_username }}' - name: '[INSTALL] - Build admin pages with pnpm' - shell: - cmd: pnpm run build + command: + cmd: 'pnpm run build' args: - chdir: "{{ etherpad_app_dir }}/app/admin" - become: yes - become_user: "{{ etherpad_username }}" - when: etherpad_admin_page == "true" \ No newline at end of file + chdir: '{{ etherpad_app_dir }}/app/admin' + become: true + become_user: '{{ etherpad_username }}' + when: etherpad_admin_page == 'true' diff --git a/tasks/installdeps.yml b/tasks/installdeps.yml index bc6456e..c1dea92 100644 --- a/tasks/installdeps.yml +++ b/tasks/installdeps.yml @@ -2,11 +2,10 @@ - name: '[INSTALLDEPS] - Install dependencies' apt: - name: "{{ etherpad_apt }}" - update_cache: yes - state: latest + name: '{{ etherpad_apt }}' + update_cache: true - name: '[INSTALLDEPS] - Install pnpm' npm: - name: pnpm - global: true \ No newline at end of file + name: 'pnpm' + global: true diff --git a/tasks/main.yml b/tasks/main.yml index 6609e64..e743287 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,28 +1,28 @@ --- -- name: Install dependencies +- name: 'Install dependencies' include_tasks: installdeps.yml -- name: Add user +- name: 'Add user' include_tasks: user.yml -- name: Clone / Update GIT +- name: 'Clone / Update GIT' include_tasks: git.yml -- name: Deploy configuration +- name: 'Deploy configuration' include_tasks: configure.yml tags: config -- name: Use abiword +- name: 'Use abiword' include_tasks: abiword.yml when: etherpad_abiword != 'null' -- name: Install etherpad +- name: 'Install etherpad' include_tasks: install.yml -- name: Install Modules +- name: 'Install Modules' include_tasks: modules.yml tags: modules -- name: Systemd +- name: 'Systemd' include_tasks: systemd.yml diff --git a/tasks/modules.yml b/tasks/modules.yml index fc5c35b..16d87b0 100644 --- a/tasks/modules.yml +++ b/tasks/modules.yml @@ -4,25 +4,27 @@ # selects only the enabled plugins # then uses filter to get all plugins names in one line, without comas or quotes as needed for npm - name: '[Modules] - Install modules' - shell: - cmd: "pnpm run install-plugins {{ etherpad_plugins_list| dict2items | selectattr('value', 'eq', 'enabled') | map(attribute='key') |join(',') | replace(\",\", \" \") }}" + command: + cmd: "pnpm run install-plugins {{ etherpad_plugins_list | dict2items | selectattr('value', 'eq', 'enabled') | map(attribute='key') | join(',') | replace(\",\", \" \") }}" args: - chdir: "{{ etherpad_app_dir }}/app" - become: yes - become_user: "{{ etherpad_username }}" + chdir: '{{ etherpad_app_dir }}/app' + become: true + become_user: '{{ etherpad_username }}' when: etherpad_plugins_list| dict2items | selectattr('value', 'eq', 'enabled') |length > 0 notify: - restart etherpad - tags: modules + - 'Restart etherpad' + tags: + - 'modules' - name: '[Modules] - Remove modules' - shell: - cmd: "pnpm run plugins rm {{ etherpad_plugins_list| dict2items | selectattr('value', 'eq', 'removed') | map(attribute='key') |join(',') | replace(\",\", \" \") }}" + command: + cmd: "pnpm run plugins rm {{ etherpad_plugins_list | dict2items | selectattr('value', 'eq', 'removed') | map(attribute='key') | join(',') | replace(\",\", \" \") }}" args: - chdir: "{{ etherpad_app_dir }}/app" - become: yes - become_user: "{{ etherpad_username }}" + chdir: '{{ etherpad_app_dir }}/app' + become: true + become_user: '{{ etherpad_username }}' when: etherpad_plugins_list| dict2items | selectattr('value', 'eq', 'removed') |length > 0 notify: - restart etherpad - tags: modules \ No newline at end of file + - 'Restart etherpad' + tags: + - 'modules' diff --git a/tasks/systemd.yml b/tasks/systemd.yml index 7de2899..5c56007 100644 --- a/tasks/systemd.yml +++ b/tasks/systemd.yml @@ -2,18 +2,17 @@ - name: '[SYSTEMD] - Deploy Systemd config' template: - src: etc/systemd/system/etherpad.service.j2 - dest: /etc/systemd/system/etherpad.service - owner: root - group: root - mode: 0644 - register: etherpad_systemd + src: 'etc/systemd/system/etherpad.service.j2' + dest: '/etc/systemd/system/etherpad.service' + owner: 'root' + group: 'root' + mode: '0644' - name: '[SYSTEMD] - Enable systemd' systemd: - name: etherpad - enabled: yes - state: started - daemon_reload: yes + name: 'etherpad' + enabled: true + state: 'started' + daemon_reload: true notify: - restart etherpad + - 'Restart etherpad' diff --git a/tasks/user.yml b/tasks/user.yml index 7862bab..0b1e2b9 100644 --- a/tasks/user.yml +++ b/tasks/user.yml @@ -3,20 +3,20 @@ - name: '[USER] - Add group' group: name: '{{ etherpad_group }}' - state: present + state: 'present' - name: '[USER] - Add user' user: name: '{{ etherpad_username }}' - shell: /bin/bash + shell: '/bin/bash' group: '{{ etherpad_group }}' home: '{{ etherpad_app_dir }}' - state: present + state: 'present' - name: '[USER] - Change ownership to etherpad user' file: path: '{{ etherpad_app_dir }}' owner: '{{ etherpad_username }}' group: '{{ etherpad_group }}' - state: directory - recurse: yes + state: 'directory' + recurse: true diff --git a/templates/var/www/etherpad-lite/settings.json.j2 b/templates/var/www/etherpad-lite/settings.json.j2 index 647ac99..654599d 100644 --- a/templates/var/www/etherpad-lite/settings.json.j2 +++ b/templates/var/www/etherpad-lite/settings.json.j2 @@ -140,7 +140,7 @@ * "full-width-editor" variant (by default editor is rendered as a page, with * a max-width of 900px). */ - "skinVariants": "{{ etherpad_skinVariants }}", + "skinVariants": "{{ etherpad_skin_variants }}", /* * IP and port which Etherpad should bind at. @@ -160,7 +160,15 @@ * * Default option is set to true */ - "showSettingsInAdminPage": {{ etherpad_showSettingsInAdminPage }}, + "showSettingsInAdminPage": {{ etherpad_show_settings_in_admin_page }}, + + /* + * Settings for cleanup of pads + */ + "cleanup": { + "enabled": {{ etherpad_cleanup_enabled }}, + "keepRevisions": {{ etherpad_cleanup_keep_revisions }} + }, /* * Node native SSL support @@ -270,10 +278,17 @@ "pageDown": true }, + /* + * Enables the use of a different server. We have a different one that syncs changes from the original server. + * It is hosted on GitHub and should not be blocked by many firewalls. + * https://etherpad.org/ep_infos + "updateServer": "https://etherpad.org/ep_infos", +*/ + /* * Should we suppress errors from being visible in the default Pad Text? */ - "suppressErrorsInPadText": {{ etherpad_suppressErrorsInPadText }}, + "suppressErrorsInPadText": {{ etherpad_suppress_errors_in_pad_text }}, /* * If this option is enabled, a user must have a session to access pads. @@ -326,7 +341,7 @@ * Allow import of file types other than the supported ones: * txt, doc, docx, rtf, odt, html & htm */ - "allowUnknownFileEnds": {{ etherpad_allowUnknownFileEnds }}, + "allowUnknownFileEnds": {{ etherpad_allow_unknown_file_ends }}, /* * This setting is used if you require authentication of all users. @@ -408,7 +423,7 @@ * will delete the cookie when the browser exits, but a session record is * kept in the database forever. */ - "sessionLifetime": {{ etherpad_sessionLifetime }}, // = 10d * 24h/d * 60m/h * 60s/m * 1000ms/s + "sessionLifetime": {{ etherpad_session_lifetime }}, // = 10d * 24h/d * 60m/h * 60s/m * 1000ms/s /* * How long (in milliseconds) before the expiration time of an active user's @@ -426,7 +441,7 @@ * Automatic session refreshes can be disabled (not recommended) by setting * this to null. */ - "sessionRefreshInterval": {{ etherpad_sessionRefreshInterval }} // = 1d * 24h/d * 60m/h * 60s/m * 1000ms/s + "sessionRefreshInterval": {{ etherpad_session_refresh_interval }} // = 1d * 24h/d * 60m/h * 60s/m * 1000ms/s }, /* @@ -440,7 +455,7 @@ * * Set to 0 to disable automatic reconnection. */ - "automaticReconnectionTimeout": {{ etherpad_automaticReconnectionTimeout }}, + "automaticReconnectionTimeout": {{ etherpad_automatic_reconnection_timeout }}, /* * By default, when caret is moved out of viewport, it scrolls the minimum @@ -527,11 +542,11 @@ {% for key, value in etherpad_plugins_list.items() %} {% if key == "ep_delete_after_delay" and value == "enabled" %} "ep_delete_after_delay": { - "delay": {{ delay }}, // one day, in seconds - "loop": {{ loopdeletion }}, - "loopDelay": {{ loopDelay }}, // one hour, in seconds - "deleteAtStart": {{ deleteAtStart }}, - "text": "{{ text }}" + "delay": {{ ep_delafter_delay }}, // one day, in seconds + "loop": {{ ep_delafter_loopdeletion }}, + "loopDelay": {{ ep_delafter_loopdelay }}, // one hour, in seconds + "deleteAtStart": {{ ep_delafter_delete_at_start }}, + "text": "{{ ep_delafter_text }}" }, {% endif %} {% endfor %} @@ -551,20 +566,21 @@ * value to work properly, but increasing the value increases susceptibility * to denial of service attacks (malicious clients can exhaust memory). */ - "maxHttpBufferSize": {{ etherpad_maxHttpBufferSize }} + "maxHttpBufferSize": {{ etherpad_max_http_buffer_size }} }, /* * Allow Load Testing tools to hit the Etherpad Instance. * - * WARNING: this will disable security on the instance. + * WARNING: this will disable security on the instance./etherpad_logLayoutType + */ "loadTest": false, /** * Disable dump of objects preventing a clean exit */ - "dumpOnUncleanExit": {{ etherpad_dumpOnUncleanExit }}, + "dumpOnUncleanExit": {{ etherpad_dump_on_unclean_exit }}, /* * Disable indentation on new line when previous line ends with some special @@ -572,7 +588,7 @@ */ /* - "indentationOnNewLine": {{ etherpad_indentationOnNewLine }}, + "indentationOnNewLine": {{ etherpad_indentation_on_new_line }}, */ /* @@ -586,10 +602,10 @@ */ "importExportRateLimiting": { // duration of the rate limit window (milliseconds) - "windowMs": {{ etherpad_importExportRateLimitingwindowMs }}, + "windowMs": {{ etherpad_import_export_rate_limiting_window_ms }}, // maximum number of requests per IP to allow during the rate limit window - "max": {{ etherpad_importExportRateLimitingMax }} + "max": {{ etherpad_import_export_rate_limiting_max }} }, /* @@ -598,7 +614,7 @@ * * File size is specified in bytes. Default is 50 MB. */ - "importMaxFileSize": {{ etherpad_importMaxFileSize }}, // 50 * 1024 * 1024 + "importMaxFileSize": {{ etherpad_import_max_file_size }}, // 50 * 1024 * 1024 /* The authentication method used by the server. @@ -653,7 +669,7 @@ * * Do not enable on production machines. */ - "exposeVersion": {{ etherpad_exposeVersion }}, + "exposeVersion": {{ etherpad_expose_version }}, /* * The log level we are using. @@ -662,11 +678,18 @@ */ "loglevel": "{{ etherpad_loglevel }}", + /* + * The log layout type to use. + * + * Valid values: basic, colored + */ + "logLayoutType": "{{ etherpad_log_layout_type }}", + /* Override any strings found in locale directories */ "customLocaleStrings": {}, /* Disable Admin UI tests */ - "enableAdminUITests": {{ etherpad_enableAdminUITests }}, + "enableAdminUITests": {{ etherpad_enable_admin_ui_tests }}, /* * Enable/Disable case-insensitive pad names.