main.ymlΒΆ

---
application_id: "web-app-odoo"
entity_name: "{{ application_id | entity_name }}"

swarm_stack_converge_retries: 600

websocket_port: "{{ lookup('config', application_id, 'services.odoo.ports.local.websocket') }}"

container_port: "{{ lookup('config', application_id, 'services.' ~ entity_name ~ '.ports.internal.http') }}"
container_websocket_port: 8072

ODOO_VERSION: "{{ lookup('config', application_id, 'services.' ~ entity_name ~'.version') }}"
ODOO_IMAGE: "{{ lookup('config', application_id, 'services.' ~ entity_name ~'.image') }}"
ODOO_CONTAINER: "{{ lookup('config', application_id, 'services.' ~ entity_name ~'.name') }}"
ODOO_SERVICE: "{{ entity_name }}"
ODOO_REPLICAS: "{{ groups[application_id] | length }}"

ODOO_PIP_DIR: "{{ [ lookup('container', application_id, 'directories.instance'), 'pip' ] | path_join }}"

ODOO_CONF_FILE_HOST: "{{ lookup('container', application_id, 'directories.volumes') }}odoo.conf"
ODOO_ADDONS_HOST: "{{ lookup('container', application_id, 'directories.volumes') }}addons/"
ODOO_ENTRYPOINT_SCRIPT_FILE: "docker-entrypoint-odoo.sh"
ODOO_ENTRYPOINT_SCRIPT_HOST_ABS: "{{ [ lookup('container', application_id, 'directories.volumes'), ODOO_ENTRYPOINT_SCRIPT_FILE ] | path_join }}"
ODOO_ENTRYPOINT_SCRIPT_HOST_REL: "volumes/{{ ODOO_ENTRYPOINT_SCRIPT_FILE }}"
ODOO_ENTRYPOINT_SCRIPT_DOCKER: "{{ [ '/usr/local/bin/', ODOO_ENTRYPOINT_SCRIPT_FILE ] | path_join }}"
ODOO_INIT_MODULES: "{{ ODOO_MODULES_CORE | join(',') }}"
ODOO_UPDATE_MARKER: "/var/lib/odoo/.odoo-update-pending"

ODOO_URL: "{{ lookup('tls', application_id, 'url.base') }}"

ODOO_OIDC_ENABLED: "{{ lookup('config', application_id, 'services.sso.enabled') }}"
ODOO_LDAP_ENABLED: "{{ lookup('config', application_id, 'services.ldap.enabled') }}"
ODOO_REDIS_ENABLED: "{{ lookup('config', application_id, 'services.redis.enabled') }}"
ODOO_OBJSTORE_ENABLED: "{{ lookup('objstore', application_id, 'enabled') }}"

ODOO_OBJSTORE_STORAGE_CODE: "{{ lookup('objstore', application_id, 'engine') }}"
ODOO_OBJSTORE_STORAGE_NAME: "Infinito Object Store"
ODOO_OBJSTORE_BUCKET: "{{ lookup('objstore', application_id, 'bucket') }}"
ODOO_OBJSTORE_OPTIONS:
  key: "{{ lookup('objstore', application_id, 'access_key') }}"
  secret: "{{ lookup('objstore', application_id, 'secret_key') }}"
  client_kwargs:
    endpoint_url: "{{ lookup('objstore', application_id, 'url') }}"
    region_name: "{{ lookup('objstore', application_id, 'region') }}"
  config_kwargs:
    s3:
      addressing_style: path
ODOO_OBJSTORE_FORCE_DB_RULES: '{"image/": 51200, "application/javascript": 0, "text/css": 0}'

ODOO_DESIGN_ENABLED: "{{ lookup('config', application_id, 'services.design.enabled') | bool }}"
ODOO_DESIGN_LOGO_ENABLED: "{{ ODOO_DESIGN_ENABLED | bool and lookup('design', application_id).logo is string }}"
ODOO_DESIGN_TITLE: "{{ lookup('design', application_id).title if ODOO_DESIGN_ENABLED | bool and lookup('design', application_id).title is string else '' }}"
ODOO_DESIGN_ASSETS_DIR: "{{ lookup('design', application_id).dest }}"
ODOO_DESIGN_SCRIPT: "{{ [role_path, 'files/python/apply/design_settings.py'] | path_join }}"
ODOO_DESIGN_THEMES:
  web.assets_backend: "{{ [role_path, 'files/theme/backend.css'] | path_join }}"
  web.assets_frontend: "{{ [role_path, 'files/theme/frontend.css'] | path_join }}"

ODOO_ADMINISTRATOR_USERNAME: "{{ lookup('users', 'platform_administrator').username }}"
ODOO_ADMINISTRATOR_PASSWORD: "{{ lookup('users', 'platform_administrator').password }}"
ODOO_ADMINISTRATOR_EMAIL: "{{ lookup('users', 'platform_administrator').email }}"

ODOO_MASTER_PASSWORD: "{{ lookup('config', application_id, 'secrets.credentials.master_password') }}"

ODOO_MODULES_CORE: "{{ lookup('config', application_id, 'addons') | dict2items | selectattr('value.group','defined') | selectattr('value.group','equalto','core')
  | map(attribute='key') | list }}"
ODOO_MODULES_OPTIONAL: "{{ lookup('config', application_id, 'addons') | dict2items | selectattr('value.group','defined') | selectattr('value.group','equalto','optional')
  | map(attribute='key') | list }}"

ODOO_DB_HOST: "{{ lookup('database', application_id, 'host') }}"
ODOO_DB_NAME: "{{ lookup('database', application_id, 'name') }}"
ODOO_DB_USER: "{{ lookup('database', application_id, 'username') }}"
ODOO_DB_PASSWORD: "{{ lookup('database', application_id, 'password') }}"
ODOO_DB_PORT: "{{ lookup('database', application_id, 'port') }}"

ODOO_EMAIL: "{{ lookup('email', application_id) }}"
ODOO_SMTP_HOST: "{{ ODOO_EMAIL.host }}"
ODOO_SMTP_PORT: "{{ ODOO_EMAIL.port | default(587) }}"
ODOO_SMTP_USER: "{{ ODOO_EMAIL.username }}"
ODOO_SMTP_PASSWORD: "{{ ODOO_EMAIL.password }}"
ODOO_SMTP_SSL: "{{ lookup('tls', application_id, 'enabled') }}"

ODOO_LDAP_SERVER: "{{ LDAP.SERVER.DOMAIN }}"
ODOO_LDAP_PORT: "{{ LDAP.SERVER.PORT }}"
ODOO_LDAP_BASE_DN: "{{ LDAP.DN.OU.USERS }}"
ODOO_LDAP_BIND_DN: "{{ LDAP.DN.ADMINISTRATOR.DATA }}"
ODOO_LDAP_BIND_PASSWORD: "{{ LDAP.BIND_CREDENTIAL }}"
ODOO_LDAP_FILTER: "({{ ODOO_LDAP_USER_ATTR }}=%s)"
ODOO_LDAP_USER_ATTR: "{{ LDAP.USER.ATTRIBUTES.ID }}"
ODOO_LDAP_CREATE_USER: true
ODOO_LDAP_TLS: "{{ LDAP.SERVER.SECURITY in ['TLS', 'SSL'] }}"

ODOO_LDAP_CONFIG:
  name: "OpenLDAP"
  sequence: 1
  company_id: 1
  ldap_server: "{{ ODOO_LDAP_SERVER }}"
  ldap_server_port: "{{ ODOO_LDAP_PORT }}"
  ldap_binddn: "{{ ODOO_LDAP_BIND_DN }}"
  ldap_password: "{{ ODOO_LDAP_BIND_PASSWORD }}"
  ldap_base: "{{ ODOO_LDAP_BASE_DN }}"
  ldap_filter: "{{ ODOO_LDAP_FILTER }}"
  create_user: "{{ ODOO_LDAP_CREATE_USER | lower }}"
  ldap_tls: "{{ ODOO_LDAP_TLS | lower }}"

ODOO_OIDC_CLIENT_ID: "{{ OIDC.CLIENT.ID }}"
ODOO_OIDC_CLIENT_SECRET: "{{ OIDC.CLIENT.SECRET }}"
ODOO_OIDC_ISSUER_URL: "{{ OIDC.CLIENT.ISSUER_URL }}"
ODOO_OIDC_AUTHORIZE_URL: "{{ OIDC.CLIENT.AUTHORIZE_URL }}"
ODOO_OIDC_TOKEN_URL: "{{ OIDC.CLIENT.TOKEN_URL }}"
ODOO_OIDC_USERINFO_URL: "{{ OIDC.CLIENT.USER_INFO_URL }}"
ODOO_OIDC_JWKS_URI: "{{ OIDC.CLIENT.CERTS }}"
ODOO_OIDC_UID_FIELD: "{{ OIDC.ATTRIBUTES.USERNAME }}"