From 750942f8645e4148af09a1d1e8474164b9119e64 Mon Sep 17 00:00:00 2001 From: L3D Date: Tue, 15 Nov 2022 23:50:49 +0100 Subject: [PATCH] Create venv for each etebase version As inspired by https://github.com/roles-ansible/ansible_role_etebase/issues/9 --- README.md | 12 +++++++----- defaults/main.yml | 2 +- tasks/migrate.yml | 2 +- vars/main.yml | 3 ++- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 6b3f1c8..9e5f1b8 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@ Ansible role to Setup and Confugure Etebase - The Backend from [EteSync](https:/ --------- This Ansible role installs and configures etebase, the backend of etesync. A piece of software to securely sync your contacts, calendars, tasks and notes! In this Ansible role, a separate user is created for etebase. The latest release of etebase is downloaded to the home of this user. A configuration is created. The specified Python dependencies are installed in a venv. And optionally etebase can be started automatically via a systemd service and uvicorn. + This Ansible role does not create users in Etebase. And the configuration for the web server is not created either. More about this in the [Additional Information](#additional-information) section. Default Variables @@ -19,7 +20,7 @@ This Ansible role does not create users in Etebase. And the configuration for th | etebase__group | ``etebase`` | The Unix Group for etebase | | etebase__user_home | ``/var/lib/etebase`` | Etebase User Home | | etebase__shell | ``/bin/false`` | Default Shell of Etebase User | -| etebase__venv | ``{{ etebase__user_home }}/venv`` | Etebase venv path | +| etebase__venv_path | ``{{ etebase__user_home }}/venv`` | Etebase venv path | | etebase__socket | ``/tmp/etebase_server.sock`` | Etebase Socket path *(only if ``etebase__systemd_setup`` is set to ``true``)* | | etebase__package_state | ``present`` | Set to ``latest`` to upgrade all etebase required system and pip packages to the latest version | | etebase__version | ``latest`` | Etebase Release Tag | @@ -60,14 +61,15 @@ You have to create a admin User by yourself. To do this, log in manually as priv cd /var/lib/etebase/ # change to latest etebase version -ls etebase_* +ls -l etebase_* cd etebase_v0.10.0 # example versiom -# enable venv -source /var/lib/etebase/venv/bin/activate +# enable latest venv +ls -l /var/lib/etebase/venv +source /var/lib/etebase/venv/v0.10.0/bin/activate # example version # create new superuser -/var/lib/etebase/venv/bin/python3 ./manage.py createsuperuser +python3 ./manage.py createsuperuser ``` By the way, this role requires that the Ansible user be allowed to execute commands with sudo privileges. diff --git a/defaults/main.yml b/defaults/main.yml index 9a4ee07..cfcb088 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -4,7 +4,7 @@ etebase__group: 'etebase' etebase__user: 'etebase' etebase__user_home: '/var/lib/etebase' etebase__shell: '/bin/false' -etebase__venv: "{{ etebase__user_home }}/venv" +etebase__venv_path: "{{ etebase__user_home }}/venv" etebase__socket: '/tmp/etebase_server.sock' # package state diff --git a/tasks/migrate.yml b/tasks/migrate.yml index df147f7..cd2b121 100644 --- a/tasks/migrate.yml +++ b/tasks/migrate.yml @@ -52,4 +52,4 @@ - name: Print hint how to create admin User ansible.builtin.debug: # yamllint disable-line rule:line-length - msg: "To create a admin user, run 'cd {{ etebase__user_home }}/etebase_{{ etebase_version_target }}; {{ etebase__venv }}/bin/python3 ./manage.py createsuperuser' as priviledged user." + msg: "To create a admin user, run 'cd {{ etebase__user_home }}/etebase_{{ etebase_version_target }}; source {{ etebase__venv }}/bin/activate; python3 ./manage.py createsuperuser' as priviledged user." diff --git a/vars/main.yml b/vars/main.yml index 11ed12a..0506204 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -1,7 +1,8 @@ --- etebase__repo: 'https://github.com/etesync/server.git' etebase__repo_api: 'https://api.github.com/repos/etesync/server/tags' +etebase__venv: "{{ etebase__venv_path }}/{{ etebase_version_target }}" # versionscheck -playbook_version_number: 10 # should be a integer +playbook_version_number: 11 # should be a integer playbook_version_path: 'role-do1jlr.etebase'