diff --git a/defaults/main.yml b/defaults/main.yml index f30ea8f..28d4670 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -81,8 +81,7 @@ etherpad_trust_proxy: "false" etherpad_cookie_same_site: "Lax" etherpad_cookie_session_lifetime: 864000000 # = 10d * 24h/d * 60m/h * 60s/m * 1000ms/s etherpad_cookie_session_refresh_interval: 864000000 # = 10d * 24h/d * 60m/h * 60s/m * 1000ms/s -etherpad_socket_transport_protocols: - ["xhr-polling", "jsonp-polling", "htmlfile"] +etherpad_socket_transport_protocols: ["websocket", "polling"] etherpad_load_test: "false" etherpad_indentation_on_new_line: "false" etherpad_automatic_reconnection_timeout: 0 @@ -96,6 +95,20 @@ etherpad_import_export_rate_limiting_max: 10 etherpad_import_max_file_size: 52428800 # 50 * 1024 * 1024 etherpad_custom_locale_strings: {} etherpad_enable_admin_ui_tests: "false" +etherpad_lower_case_pad_ids: "false" +etherpad_authentication_method: "apikey" # or sso +etherpad_sso_issuer: "http://localhost:9001" +etherpad_sso_clients: [] +# - client_id: "client_id" +# client_secret: "client_secret" +# grant_types: ["authorization_code"] +# response_types: ["code"] +# redirect_uris: ["http://localhost:9001/admin"] +etherpad_ttl_access_token: 3600 +etherpad_ttl_authorization_code: 600 +etherpad_ttl_client_credentials: 3600 +etherpad_ttl_id_token: 3600 +etherpad_ttl_refresh_token: 86400 etherpad_toolbar: left: - ["bold", "italic", "underline", "strikethrough"] @@ -164,8 +177,5 @@ etherpad_headerauth_displayname_header: x-authenticated-name # Change to "python-pymysql" on python2 systems etherpad_python_mysql_package: "python3-mysqldb" - # Copy a custom logo file to src/static/ #etherpad_custom_logo_src: - -etherpad_node_path: "/usr/bin/node" diff --git a/molecule/default/converge.yml b/molecule/default/converge.yml index 7f1f03f..5154af9 100644 --- a/molecule/default/converge.yml +++ b/molecule/default/converge.yml @@ -5,6 +5,6 @@ roles: - role: ansible-role-etherpad vars: - etherpad_repository_version: 1.9.2 + etherpad_repository_version: 2.0.3 etherpad_api_key: "secure_api_key" etherpad_abiword_enabled: true diff --git a/molecule/default/prepare.yml b/molecule/default/prepare.yml index 6f304b4..709175a 100644 --- a/molecule/default/prepare.yml +++ b/molecule/default/prepare.yml @@ -15,5 +15,7 @@ ansible.builtin.include_role: name: geerlingguy.nodejs vars: - nodejs_version: 18.x + nodejs_version: 20.x nodejs_install_npm_user: "root" + nodejs_npm_global_packages: + - name: pnpm diff --git a/tasks/preflight.yml b/tasks/preflight.yml index 979379f..fd9ce60 100644 --- a/tasks/preflight.yml +++ b/tasks/preflight.yml @@ -6,6 +6,14 @@ fail_msg: "Etherpad API Key is not set" success_msg: "Etherpad API Key is set" +- name: Assert that Etherpad SSO Config is set properly + ansible.builtin.assert: + that: + - etherpad_sso_clients | length > 0 + fail_msg: "Etherpad SSO Config is not set properly" + success_msg: "Etherpad SSO Config looks good" + when: etherpad_authentication_method == "sso" + - name: Check NodeJS is installed ansible.builtin.shell: node --version | sed 's/^.//' changed_when: false @@ -26,3 +34,17 @@ - node_version.stdout is version(etherpad_min_node_version, '>=') fail_msg: "NodeJS version {{ node_version.stdout }} is not supported. Minimum required version is {{ etherpad_min_node_version }}" success_msg: "NodeJS version {{ node_version.stdout }} is supported" + +- name: Check pnpm is installed + ansible.builtin.command: pnpm --version + changed_when: false + check_mode: no + register: pnpm_version + ignore_errors: true + +- name: Assert that pnpm is installed + ansible.builtin.assert: + that: + - pnpm_version.rc == 0 + fail_msg: "pnpm is not installed" + success_msg: "pnpm is installed" diff --git a/templates/etc/systemd/system/etherpad-lite.service.j2 b/templates/etc/systemd/system/etherpad-lite.service.j2 index 2ab6c48..62d8917 100644 --- a/templates/etc/systemd/system/etherpad-lite.service.j2 +++ b/templates/etc/systemd/system/etherpad-lite.service.j2 @@ -7,7 +7,7 @@ Type=simple User={{ etherpad_user }} Group={{ etherpad_group }} WorkingDirectory={{ etherpad_path }} -ExecStart={{ etherpad_node_path }} {{ etherpad_path }}/node_modules/ep_etherpad-lite/node/server.js +ExecStart={{ etherpad_path }}/bin/run.sh Environment=NODE_ENV={{ etherpad_node_environment }} Restart=always diff --git a/templates/settings.json.j2 b/templates/settings.json.j2 index 0009193..4001210 100644 --- a/templates/settings.json.j2 +++ b/templates/settings.json.j2 @@ -176,5 +176,20 @@ }, "importMaxFileSize": {{ etherpad_import_max_file_size }}, "customLocaleStrings": {{ etherpad_custom_locale_strings|to_json }}, - "enableAdminUITests": {{ etherpad_enable_admin_ui_tests }} + "enableAdminUITests": {{ etherpad_enable_admin_ui_tests }}, + "authenticationMethod": {{ etherpad_authentication_method }}, + "lowerCasePadIds": {{ etherpad_lower_case_pad_ids }}, + {% if authenticationMethod == "sso" %} + "sso": { + "issuer": "{{ etherpad_sso_issuer }}", + "clients": {{ etherpad_sso_clients|to_json }}, + }, + {% endif %} + "ttl": { + "AccessToken": "{{ etherpad_ttl_access_token }}", + "AuthorizationCode": "{{ etherpad_ttl_authorization_code }}", + "ClientCredentials": "{{ etherpad_ttl_client_credentials }}", + "IdToken": "{{ etherpad_ttl_id_token }}", + "RefreshToken": "{{ etherpad_ttl_refresh_token }}" + } } diff --git a/vars/main.yml b/vars/main.yml index 8c94e33..10527a2 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -1,2 +1,2 @@ --- -etherpad_min_node_version: "16.20.1" +etherpad_min_node_version: "18.18.2"