coopdevs.odoo-role
Odoo Ansible Provisioning Role
This is an Ansible role for setting up Odoo. It works with:
- Odoo 12
- Odoo 11
- Odoo 10
It hasn't been tested with Odoo 13 yet.
Requirements
You need PostgreSQL version 9.5 or higher.
Currently, this role only supports "peer authentication" to access the PostgreSQL database. You must create a database in PostgreSQL, a user with access to that database, and a system user with the same username.
For example, you can create a PostgreSQL user named odoo
, allow access to the database you created, and also create a system user named odoo
.
Role Variables
Below are the available settings with their default values:
Edition
You can choose how to install Odoo: using git
(from a git repository) or tar
(a compressed file).
# Odoo download method: tar or git
odoo_role_download_strategy: tar
# Settings for tar download method
odoo_role_odoo_version: 11.0
odoo_role_odoo_release: 20190505
odoo_role_odoo_url: "https://nightly.odoo.com/{{ odoo_role_odoo_version }}/nightly/src/odoo_{{ odoo_role_odoo_version }}.{{ odoo_role_odoo_release }}.tar.gz"
odoo_role_odoo_download_path: "{{ odoo_role_odoo_path }}/../odoo_releases/odoo_{{ odoo_role_odoo_version }}.{{ odoo_role_odoo_release }}.tar.gz"
# Settings for git download method
odoo_role_odoo_git_url: "https://github.com/OCA/OCB.git"
odoo_role_odoo_git_ref: "11.0"
odoo_role_pip_version: "23.1.2"
Users and Groups
odoo_role_odoo_user: odoo
odoo_role_odoo_group: odoo
Directory Structure
odoo_role_odoo_venv_path: /opt/.odoo_venv
odoo_role_odoo_path: /opt/odoo
odoo_role_odoo_bin_path: "{{ odoo_role_odoo_path }}/build/scripts-2.7/odoo"
odoo_role_odoo_python_path: "{{ odoo_role_odoo_venv_path }}/bin/python"
odoo_role_odoo_config_path: /etc/odoo
odoo_role_odoo_log_path: /var/log/odoo
odoo_role_odoo_modules_path: /opt/odoo/modules
Databases
odoo_role_odoo_dbs: [ "odoo" ]
odoo_role_dbfilter_enabled: true
odoo_role_odoo_db_admin_password: 1234
odoo_role_demo_data: false
odoo_role_list_db: false
Odoo HTTP Server Settings
odoo_role_odoo_http_interface: 0.0.0.0
odoo_role_odoo_proxy_mode: false
odoo_role_workers: 2
Other Odoo Server Settings
odoo_role_limit_time_cpu: 60
odoo_role_limit_time_real: 120
odoo_role_limit_memory_hard: 2684354560
odoo_role_limit_memory_soft: 2147483648
Core Modules to Install/Update
odoo_role_odoo_core_modules_dict:
shared:
- base
db1:
- account
Community Modules to Install/Update
odoo_role_odoo_community_modules_dict:
shared:
- web_responsive
db1:
- mis_reports
Force Update Odoo Modules
To force update a module, run provisioning with:
-e "odoo_role_modules_force_update=['l10n_es']"
Development Mode
You can run Odoo in development mode, which allows auto-reloading when code changes:
odoo_role_dev_mode: true
To start Odoo in this mode, use:
./odoo-bin -c /etc/odoo/odoo.conf --dev all
Support for Other Features
- Rest Framework: Enable it with:
odoo_role_enable_rest_framework: true
- Queue Job: Enable it with:
odoo_role_enable_queue_job: true
- Server-wide Modules: Install additional modules with:
odoo_role_odoo_server_wide_modules: ['module1', 'module2']
Workers Configuration
You can set how many workers to use for jobs with:
odoo_role_channels: root:2
Enable Sentry Support
To use the Sentry module, enable it with:
odoo_role_enable_sentry: true
odoo_role_sentry_dsn: https://your_sentry_url
Internationalization (i18n) Overwrite
Force overwrite for i18n with:
odoo_role_i18n_overwrite: true
Environment Variables
Define environment variables for your server like this:
environment_variables:
var_name1: "var_value1"
var_name2: "var_value2"
Role Tags
Use the only-modules
tag to install or update Odoo modules without a full setup like this:
ansible-playbook playbook.yml --tags "only-modules"
Developer Aids
A template is provided for aliases and scripts for backup and restore can be added. You can skip this by setting:
odoo_role_dev_helpers: true
Community Roles
Deploy
To use community roles, deploy these modules with pip
. Manage the modules via a requirements.txt
file.
Install
Once modules are on the server, install them in the database by defining:
odoo_role_odoo_community_modules: 'contract,contract_sale_invoicing'
Dependencies
This role does not depend on other roles yet.
Example Playbook
- hosts: odoo_servers
roles:
- role: coopdevs.odoo-role
vars:
odoo_role_odoo_db_name: odoo-db
odoo_role_odoo_db_admin_password: "{{ odoo_admin_password }}"
odoo_role_download_strategy: tar
odoo_role_odoo_version: 11.0
odoo_role_odoo_release: 20180424
Developing & Testing
Use the devenv
tool to manage local virtual machines and test the role quickly.
Release Process
To publish a new release, go to releases and create a new tag. Add a changelog with details of changes.
License
GPLv3
Author Information
@ygneo
http://coopdevs.org
Odoo 10+ provisioning role
ansible-galaxy install coopdevs.odoo-role