{"id":19109994,"url":"https://github.com/coopdevs/odoo-role","last_synced_at":"2025-04-30T20:35:10.788Z","repository":{"id":37430840,"uuid":"128103601","full_name":"coopdevs/odoo-role","owner":"coopdevs","description":"Ansible role provisioning Odoo.","archived":false,"fork":false,"pushed_at":"2024-12-13T09:17:00.000Z","size":239,"stargazers_count":13,"open_issues_count":12,"forks_count":20,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-04-19T08:33:14.742Z","etag":null,"topics":["ansible","ansible-role","odoo"],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/coopdevs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-04-04T18:25:20.000Z","updated_at":"2024-12-10T09:43:41.000Z","dependencies_parsed_at":"2024-04-22T17:42:08.317Z","dependency_job_id":"38fbdd10-5b70-4d5f-9509-103ae449d356","html_url":"https://github.com/coopdevs/odoo-role","commit_stats":null,"previous_names":[],"tags_count":62,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coopdevs%2Fodoo-role","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coopdevs%2Fodoo-role/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coopdevs%2Fodoo-role/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coopdevs%2Fodoo-role/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/coopdevs","download_url":"https://codeload.github.com/coopdevs/odoo-role/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251778078,"owners_count":21642275,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ansible","ansible-role","odoo"],"created_at":"2024-11-09T04:23:13.567Z","updated_at":"2025-04-30T20:35:10.760Z","avatar_url":"https://github.com/coopdevs.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"An Odoo Ansible Provisioning Role\n=========================================\n\nThis an Ansible role for provisioning Odoo. It supports:\n\n* Odoo 12\n* Odoo 11\n* Odoo 10\n\nI has not been tested yet with Odoo 13.\n\nRequirements\n------------\n\nA PostgreSQL(9.5+).\n\nBy now this role only supports peer authentication for PostgreSQL database access.\n\nSo you need to create a database in PostgreSQL, one user with access to that database, and one system user with same username.\n\nFor instance, you can create an `odoo` user in PostgreSQL with access to the created database, and an user named `odoo` in your system.\n\nRole Variables\n--------------\n\nAvailable variables are listed below, along with default values:\n\n* Edition\n\nThis role supports installing Odoo following two different strategies: `git` (from a git repository) and `tar` (a package or compressed release file).\n\n```yml\n# Odoo releases download strategy: tar or git\nodoo_role_download_strategy: tar\n\n# Vars for tar download strategy\n# supported any other formats supported by ansible unarchive, i.e. by unzip or gtar)\n# Releases from Odoo.com odoo nightly\nodoo_role_odoo_version: 11.0 # not used outside this file\nodoo_role_odoo_release: 20190505 # not used outside this file\nodoo_role_odoo_url: \"https://nightly.odoo.com/{{ odoo_role_odoo_version }}/nightly/src/odoo_{{ odoo_role_odoo_version }}.{{ odoo_role_odoo_release }}.tar.gz\"\n# Releases from an Odoo comunity backports updated fork\n# odoo_role_odoo_release: \"11.0_2019-05-05\"\n# odoo_role_odoo_url: \"https://gitlab.com/coopdevs/OCB/-/archive/{{ odoo_role_odoo_release }}/OCB-{{ odoo_role_odoo_release }}.tar.gz\"\nodoo_role_odoo_download_path: \"{{ odoo_role_odoo_path }}/../odoo_releases/odoo_{{ odoo_role_odoo_version }}.{{ odoo_role_odoo_release }}.tar.gz\"\n\n# Vars for git download strategy\nodoo_role_odoo_git_url: \"https://github.com/OCA/OCB.git\"\n# OCA's OCB, branch 11.0. LTS probably until 14.0 release. 13.0 is scheduled for October 2019.\nodoo_role_odoo_git_ref: \"11.0\"\n# Variable to define pip version\nodoo_role_pip_version: \"23.1.2\"\n\n# Variable for force reinstall existing python version in pyenv. When set to false, the role will not reinstall the python version (using `--skip-existing` flag).\nodoo_role_force_pyenv_version: false\n```\n\n* Users and group\n\n```yml\nodoo_role_odoo_user: odoo\nodoo_role_odoo_group: odoo\n```\n\n* Directories structure\n\n```yml\nodoo_role_odoo_venv_path: /opt/.odoo_venv\nodoo_role_odoo_path: /opt/odoo\nodoo_role_odoo_bin_path: \"{{ odoo_role_odoo_path }}/build/scripts-2.7/odoo\"\nodoo_role_odoo_python_path: \"{{ odoo_venv_path }}/bin/python\"\nodoo_role_odoo_config_path: /etc/odoo\nodoo_role_odoo_log_path: /var/log/odoo\nodoo_role_odoo_modules_path: /opt/odoo/modules\n```\n\n* Databases\n\n```yml\n# Array of DBs that the role will create.\nodoo_role_odoo_dbs: [ \"odoo\" ]\n# In a multidb environment, where more than one group use the same instance with isolated views,\n# each db name must match the DNS name it will accessed from in order for Odoo to direct the queries to the right DB.\nodoo_role_odoo_dbs: [ \"odoo.some.coop\", \"erp.another.org\" ]\n# Only in multidb environment, select DB based on the HTTP Host header.\nodoo_role_dbfilter_enabled: true\n# This is the password Odoo asks to user allow them to create, delete, etc. DBs\nodoo_role_odoo_db_admin_password: 1234\n# Whether to populate db with example data or not.\nodoo_role_demo_data: false\n# Give the chance to select a database before login (when dbfilter disabled), and enable db manager web interface\nodoo_role_list_db: false\n```\n\n* Odoo HTTP server settings\n\n```yml\n# Set this to 127.0.0.1 when Odoo runs behind a reverse proxy\nodoo_role_odoo_http_interface: 0.0.0.0\n# Set this to true when Odoo runs behind a reverse proxy\nodoo_role_odoo_proxy_mode: false\n# Specify how many HTTP workers you need (default is 1)\nodoo_role_workers: 2\n```\n\n* Odoo other server settings\n\n```yml\n# Customize the Odoo timeouts\nodoo_role_limit_time_cpu: 60\nodoo_role_limit_time_real: 120\n\n# Customize the Odoo memory limits\nodoo_role_limit_memory_hard: 2684354560\nodoo_role_limit_memory_soft: 2147483648\n```\n\n* Core modules list to install/update\n\n```yml\n# List of modules to install before running the server. \"Shared\" part is common to all db's, specific db modules goes into their \"db\" part\nodoo_role_odoo_core_modules_dict:\n  shared:\n    - base\n  db1:\n    - account\n```\n\n* Community modules list to install/update\n\n```yml\n# List of modules to install before running the server. \"Shared\" part is common to all db's, specific db modules goes into their \"db\" part\n\nodoo_role_odoo_community_modules_dict:\n  shared:\n    - web_responsive\n  db1:\n    - mis_reports\n```\n\n* Force update odoo modules\nIn order to force update an odoo module or a list of modules execute provisioning with the command\n\n```\n-e \"odoo_role_modules_force_update=['l10n_es']\"\n```\n\n* Development mode\n\nOdoo has a mode to auto-reload the server when the code changes and read the views from the code to agile the development process. Using the command line parameter [`--dev`](https://www.odoo.com/documentation/12.0/reference/cmdline.html#developer-features) we can run Odoo in a development mode.\n\n```yaml\nodoo_role_dev_mode: true\n```\n\nIf this mode is active, the systemd unit is not created and you need to run the Odoo process manually.\nYou can start it with the following command:\n\n```sh\n./odoo-bin -c /etc/odoo/odoo.conf --dev all\n```\n\n* [Rest Framework](https://github.com/OCA/rest-framework/tree/12.0/base_rest) support\n\nIf you need to use the Rest Framework and want to start the server in development mode, use:\n\n```yaml\nodoo_role_enable_rest_framework: true\n```\n\nThis option add to the Odoo configuration file the section and option to development mode: \u003chttps://github.com/OCA/rest-framework/tree/12.0/base_rest#configuration\u003e\n\n* [Queue Job](https://github.com/OCA/queue/blob/12.0/queue_job) support\n\nIf you need to use the module [queue\\_job](https://github.com/OCA/queue/blob/12.0/queue_job), use:\n\n```yaml\nodoo_role_enable_queue_job: true\n```\n\nThis option add to the Odoo configuration file the option to enable queue\\_job as a new thread/process: \u003chttps://github.com/OCA/queue/blob/12.0/queue\\_job/README.rst#id12\u003e\n\n* Server-wide modules\n\nIf you need to install some wide-server modules apart from `db_filter` and `queue_job`, use:\n\n```yaml\nodoo_role_odoo_server_wide_modules: ['module1', 'module2']\n```\n\nBy default, it configures as a server-wide modules `web` and `base` -as long as they are mandatory from Odoo v12- in every case and `db_filter` and `queue_job` if the corresponding variables are set to `true` .\n\n* Workers configuration\n\nYou can also define how many workers you want to use to execute the jobs:\n\n```yaml\nodoo_role_channels: root:2\n```\n\n* [sentry](https://github.com/OCA/server-tools/tree/12.0/sentry) support\n\nIf you want to use the module [setnry](https://github.com/OCA/server-tools/tree/12.0/sentry), use:\n\n```yaml\nodoo_role_enable_sentry: true\nodoo_role_sentry_dsn: https://your_sentry_url\n```\n\n* i18n Overwrite\n\nWe can force the i18n overwrite using the next variable:\n\n```yaml\nodoo_role_i18n_overwrite: true\n```\n\nYou can define this var in the inventory or use it when execute a playbook:\n\n```bash\nansible-playbook playbooks/provision.yml -i ../my-inventory/inventory/hosts --ask-vault-pass --limit=host -e \"{odoo_role_i18n_overwrite: true}\"\n```\n\n* Environment variables\n\nIf you need to define a set of environment variables for your server, you can use the `environment_variables` dict var:\n\n```yaml\nenvironment_variables:\n  var_name1: \"var_value1\"\n  var_name2: \"var_value2\"\n  var_name3: \"var_value3\"\n```\n\nThis option add a file in `/etc/default/odoo` with the vars and add to the Systemd service the `EnvironmentFile` attribute pointing to `/etc/default/odoo.\n\nRole Tags\n---------------\n\n* Using the `only-modules` Tag\n\nThis tag helps you install or update Odoo modules without performing a full setup. Run the playbook with the `--tags` option:\n\n```bash\nansible-playbook playbook.yml --tags \"only-modules\"\n```\n\nDeveloper aids\n---------------\n\n* A [template](/templates/00-aliases.sh) with [`ct`](https://xardin.netlify.app/sys-admin/color-tail-output-in-odoo-logs/) alias is rendered to `/etc/profile.d/`.\n* Add [`odoo-backup`](https://janikvonrotz.ch/2020/04/02/automate-odoo-backups-with-this-script/) and [`odoo-restore`](https://janikvonrotz.ch/2020/05/19/restore-odoo-database-with-this-script/) scripts.\n\nYou can skip this by setting the `odoo_role_dev_helpers` var to `false`.\n\n```yaml\nodoo_role_dev_helpers: true\n```\n\nx\nCommunity Roles\n---------------\n\n#### Deploy\n\nTo use community roles, you need to deploy this modules in the server. This role manage the modules deployment with `pip`.\n\nYou can define a `requirements.txt` file to manage the modules and ensure the version installed:\n\n```\n# requirements.txt\nodoo11-addon-contract==11.0.2.1.0\nodoo11-addon-contract-sale-invoicing==11.0.1.0.0\nodoo11-addon-contract-variable-qty-timesheet==11.0.1.0.0\nodoo11-addon-contract-variable-quantity==11.0.1.2.1\n```\n\n\u003e The default `requirements.txt` file path is `\"{{ inventory_dir }}/../files/requirements.txt\"`.\n\u003e\n\u003e You can change it with the `odoo_role_community_modules_requirements_path` var.\n\u003e\n\u003e This allows you to have different `requirements.txt` files and use them on a conditional way.\n\u003e\n\u003e For example, you could set it `{{ inventory_dir }}/../files/requirements-dev.txt`\n\u003e and use it for dev envs redefining the variable at `host_vars` level.\n\n# Install\n\nOnce the modules are in the server, you need to install them in the database.\n\nDefine a `odoo_role_odoo_community_modules` var with the list of the modules names you want to install.\n\n```yml\n# inventory/group_vars/all.yml\nodoo_role_odoo_community_modules: 'contract,contract_sale_invoicing'\n```\n\nDependencies\n------------\n\nThis role is not depending on other roles (yet).\n\nExample Playbook\n----------------\n\n```yaml\n- hosts: odoo_servers\n  roles:\n    - role: coopdevs.odoo-role\n      vars:\n        odoo_role_odoo_db_name: odoo-db\n        odoo_role_odoo_db_admin_password: \"{{ odoo_admin_password }}\"\n        odoo_role_download_strategy: tar\n        odoo_role_odoo_version: 11.0\n        odoo_role_odoo_release: 20180424\n```\n\nDeveloping \u0026 Testing\n-------\n\nFor developing and testing the role, we use [`devenv`](https://github.com/coopdevs/devenv) to manage local virtual machines in Linux environments.\n\nYou can use the `.devenv` file in `tests` folder to create a virtual machine.\n\n```bash\ndevenv\n```\n\nThen, you can test the role with the following command:\n\n```bash\nansible-playbook devenv.yml -i inventory\n```\n\nIt will provision a virtual machine with postgresql and then, execute the role.\n\nRelease\n-------\n\nTo publish a new release:\n\n* Go to [releases](https://github.com/coopdevs/odoo-role/releases) and click  on `Draft a new release`.\n* Create a new tag on `Choose a tag` and update the description with the changelog, as the example below:\n\n```\n## What's Changed\n* feat: invert add-ons paths order by @oyale in https://github.com/coopdevs/odoo-role/pull/135\n* Add pytest and coverage packages to dev environments by @oyale in https://github.com/coopdevs/odoo-role/pull/136\n\n\n**Full Changelog**: https://github.com/coopdevs/odoo-role/compare/v0.3.4...v0.3.5\n```\n\n* After publishing the release go to [`ansible galaxy`](https://galaxy.ansible.com/) to import the new release. You should find the odoo-role repository under `My content`.\n\nLicense\n-------\n\nGPLv3\n\nAuthor Information\n------------------\n\n@ygneo\n\u003chttp://coopdevs.org\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoopdevs%2Fodoo-role","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoopdevs%2Fodoo-role","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoopdevs%2Fodoo-role/lists"}