From b40c37914c221526b7b3b24324c18fbc92f725b6 Mon Sep 17 00:00:00 2001 From: phil Date: Wed, 27 Sep 2023 16:35:10 +0200 Subject: [PATCH] first commit --- README.md | 15 ++++++++++++++ defaults/main.yml | 7 +++++++ meta/main.yml | 10 ++++++++++ tasks/database.yml | 16 +++++++++++++++ tasks/install.yml | 50 ++++++++++++++++++++++++++++++++++++++++++++++ tasks/main.yml | 9 +++++++++ 6 files changed, 107 insertions(+) create mode 100644 README.md create mode 100644 defaults/main.yml create mode 100644 meta/main.yml create mode 100644 tasks/database.yml create mode 100644 tasks/install.yml create mode 100644 tasks/main.yml diff --git a/README.md b/README.md new file mode 100644 index 0000000..30a7249 --- /dev/null +++ b/README.md @@ -0,0 +1,15 @@ +OnlyOffice +========== + +Installation of OnlyOffice according to the [documentation](https://helpcenter.onlyoffice.com/installation/docs-community-install-ubuntu.aspx). + +# Variables + +| Name | Type | Default | +|------|------|---------| +| `onlyoffice_db_host` | string | localhost | +| `onlyoffice_db_use` | string | onlyoffice | +| `onlyoffice_db_password` | string | *not set* | +| `onlyoffice_db_name` | string | onlyoffice | +| `onlyoffice_jwt_secret` | string | *not set* | +| `onlyoffice_ds_port` | int | 80 | diff --git a/defaults/main.yml b/defaults/main.yml new file mode 100644 index 0000000..fabdfe0 --- /dev/null +++ b/defaults/main.yml @@ -0,0 +1,7 @@ +--- +onlyoffice_db_host: localhost +onlyoffice_db_user: onlyoffice +onlyoffice_db_name: onlyoffice +onlyoffice_ds_port: 80 + +database_host: "{{ onlyoffice_db_host }}" diff --git a/meta/main.yml b/meta/main.yml new file mode 100644 index 0000000..b55a521 --- /dev/null +++ b/meta/main.yml @@ -0,0 +1,10 @@ +galaxy_info: + author: Sense.Lab admins + description: Role to install OnlyOffice Documentserver + company: Sense.Lab e.V. + license: GPLv3 + min_ansible_version: "2.11" + platforms: + - name: Debian + versions: + - bookworm diff --git a/tasks/database.yml b/tasks/database.yml new file mode 100644 index 0000000..c081465 --- /dev/null +++ b/tasks/database.yml @@ -0,0 +1,16 @@ +--- +- name: "Database | Create database" + community.postgresql.postgresql_db: + name: "{{ onlyoffice_db_name }}" + encoding: UTF8 + template: template0 + become: true + become_user: postgres + +- name: "Database | Create user role" + community.postgresql.postgresql_user: + name: "{{ onlyoffice_db_user }}" + password: "{{ onlyoffice_db_password }}" + db: "{{ onlyoffice_db_name }}" + become: true + become_user: postgres diff --git a/tasks/install.yml b/tasks/install.yml new file mode 100644 index 0000000..e22bc20 --- /dev/null +++ b/tasks/install.yml @@ -0,0 +1,50 @@ +--- +- name: "Install | Add Onlyoffice repository" + block: + - name: Add repository key + ansible.builtin.get_url: + url: https://download.onlyoffice.com/GPG-KEY-ONLYOFFICE + dest: /etc/apt/trusted.gpg.d/onlyoffice.asc + mode: "0644" + + - name: Add repository + ansible.builtin.apt_repository: + repo: deb [signed-by=/usr/share/keyrings/onlyoffice.gpg] https://download.onlyoffice.com/repo/debian squeeze main + filename: onlyoffice + +- name: "Install | Set debconf options" + ansible.builtin.debconf: + name: onlyoffice-documentserver + question: "onlyoffice/{{ item.question }}" + value: "{{ item.value }}" + vtype: "{{ item.vtype }}" + loop: + - question: db-host + value: "{{ onlyoffice_db_host }}" + vtype: string + - question: db-user + value: "{{ onlyoffice_db_user }}" + vtype: string + - question: db-pwd + value: "{{ onlyoffice_db_password }}" + vtype: password + - question: db-name + value: "{{ onlyoffice_db_name }}" + vtype: string + - question: jwt-enabled + value: true + vtype: boolean + - question: jwt-secret + value: "{{ onlyoffice_jwt_secret }}" + vtype: password + - question: ds-port + value: "{{ onlyoffice_ds_port }}" + vtype: select + +- name: "Install | Install packages" + ansible.builtin.apt: + pkg: + - nginx-extras + - rabbitmq-server + - onlyoffice-documentserver + - ttf-mscorefonts-installer diff --git a/tasks/main.yml b/tasks/main.yml new file mode 100644 index 0000000..9f53cb3 --- /dev/null +++ b/tasks/main.yml @@ -0,0 +1,9 @@ +--- +- name: Setup database + ansible.builtin.import_tasks: database.yml + tags: database + delegate_to: "{{ database_host }}" + +- name: Install packages + ansible.builtin.import_tasks: install.yml + tags: install