diff --git a/roles/odoo/defaults/main.yml b/roles/odoo/defaults/main.yml index 668089c..bd27b9e 100644 --- a/roles/odoo/defaults/main.yml +++ b/roles/odoo/defaults/main.yml @@ -11,6 +11,11 @@ odoo_root_dir: /opt/odoo # User under which odoo will run (will be created if needed odoo_user: odoo +# Enabling DB manager will : +# - Enable the Odoo database manager from the web interface +# - Make odoo a SUPERUSER on the postgres server (so it should use a dedicated postgres server) +odoo_db_manager: False + # Database settings odoo_db_server: "{{ pg_server | default('localhost') }}" odoo_db_port: 5432 @@ -33,9 +38,6 @@ odoo_ports: [ "{{ odoo_http_port }}", "{{ odoo_gevent_port }}" ] odoo_workers: 4 odoo_email: "{{ system_admin_email | default('admin' + ansible_domain ) }}" -# If enabled, db manager will be accessible -odoo_db_list: False - # If you turn enterprise on, you need to set the SSH key of the root account of the target system # on your Github account, allowed to access the https://github.com/odoo/enterprise.git repo # You should also accept the host key for example by running diff --git a/roles/odoo/tasks/install.yml b/roles/odoo/tasks/install.yml index ad33306..7214c76 100644 --- a/roles/odoo/tasks/install.yml +++ b/roles/odoo/tasks/install.yml @@ -66,6 +66,7 @@ login_host: "{{ odoo_db_server }}" login_user: sqladmin login_password: "{{ pg_admin_pass }}" + role_attr_flags: "LOGIN{{ odoo_db_manager | ternary(',CREATEDB,SUPERUSER','') }}" tags: odoo - name: Create the PostgreSQL database diff --git a/roles/odoo/templates/odoo-server.conf.j2 b/roles/odoo/templates/odoo-server.conf.j2 index 13ce510..f65d7a0 100644 --- a/roles/odoo/templates/odoo-server.conf.j2 +++ b/roles/odoo/templates/odoo-server.conf.j2 @@ -1,5 +1,7 @@ [options] +{% if not odoo_db_manager %} db_name = {{ odoo_db_name }} +{% endif %} db_host = {{ odoo_db_server }} db_port = {{ odoo_db_port }} db_user = {{ odoo_db_user }} diff --git a/roles/odoo/templates/odoo-server.service.j2 b/roles/odoo/templates/odoo-server.service.j2 index 63d1d44..cf88e82 100644 --- a/roles/odoo/templates/odoo-server.service.j2 +++ b/roles/odoo/templates/odoo-server.service.j2 @@ -6,7 +6,7 @@ After=network.service Type=simple User={{ odoo_user }} Group={{ odoo_user }} -ExecStart={{ odoo_root_dir }}/venv/bin/python3 {{ odoo_root_dir }}/app/setup/odoo -c {{ odoo_root_dir }}/etc/odoo-server.conf --proxy-mode{% if not odoo_db_list %} --no-database-list{% endif %} +ExecStart={{ odoo_root_dir }}/venv/bin/python3 {{ odoo_root_dir }}/app/setup/odoo -c {{ odoo_root_dir }}/etc/odoo-server.conf --proxy-mode{% if not odoo_db_manager %} --no-database-list{% endif %} PrivateTmp=yes PrivateDevices=yes