module_ops.ymlΒΆ

---
- name: "πŸ“¦ Install core modules"
  no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}"
  shell: > # nocheck: container-exec-resolver  runtime-resolved CID, delegated to the hosting node
    container exec {{ ODOO_LOCAL_CID | quote }}
    odoo -i {{ odoo_modules_to_install }}
    -d {{ ODOO_DB_NAME }}
    --db_host {{ ODOO_DB_HOST }}
    --db_port {{ ODOO_DB_PORT }}
    --db_user {{ ODOO_DB_USER }}
    --stop-after-init
    --no-http
  delegate_to: "{{ ODOO_HOST_NODE }}"
  register: module_install
  changed_when: "'loading' in (module_install.stdout ~ module_install.stderr)"
  failed_when: >-
    module_install.rc != 0
    or 'invalid module names' in (module_install.stdout ~ module_install.stderr)
  when: odoo_modules_to_install | length > 0

- name: "πŸ“¦ Install OIDC-related modules (auth_oauth + auth_signup + auth_oauth_https)"
  when: ODOO_OIDC_ENABLED | bool
  block:
    - name: "πŸ“¦ Install auth_oauth module for OIDC support"
      no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}"
      shell: > # nocheck: container-exec-resolver  runtime-resolved CID, delegated to the hosting node
        container exec {{ ODOO_LOCAL_CID | quote }}
        odoo -i auth_oauth
        -d {{ ODOO_DB_NAME }}
        --db_host {{ ODOO_DB_HOST }}
        --db_port {{ ODOO_DB_PORT }}
        --db_user {{ ODOO_DB_USER }}
        --stop-after-init
        --no-http
      delegate_to: "{{ ODOO_HOST_NODE }}"
      register: auth_oauth_install
      changed_when: "'loading' in (auth_oauth_install.stdout ~ auth_oauth_install.stderr)"
      failed_when: >-
        auth_oauth_install.rc != 0
        or 'invalid module names' in (auth_oauth_install.stdout ~ auth_oauth_install.stderr)

    - name: "πŸ“¦ Install auth_signup module for OAuth user auto-creation"
      no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}"
      shell: > # nocheck: container-exec-resolver  runtime-resolved CID, delegated to the hosting node
        container exec {{ ODOO_LOCAL_CID | quote }}
        odoo -i auth_signup
        -d {{ ODOO_DB_NAME }}
        --db_host {{ ODOO_DB_HOST }}
        --db_port {{ ODOO_DB_PORT }}
        --db_user {{ ODOO_DB_USER }}
        --stop-after-init
        --no-http
      delegate_to: "{{ ODOO_HOST_NODE }}"
      register: auth_signup_install
      changed_when: "'loading' in (auth_signup_install.stdout ~ auth_signup_install.stderr)"
      failed_when: >-
        auth_signup_install.rc != 0
        or 'invalid module names' in (auth_signup_install.stdout ~ auth_signup_install.stderr)

    - name: "πŸ“¦ Install auth_oauth_https module for HTTPS redirect URI fix"
      no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}"
      shell: > # nocheck: container-exec-resolver  runtime-resolved CID, delegated to the hosting node
        container exec {{ ODOO_LOCAL_CID | quote }}
        odoo -i auth_oauth_https
        -d {{ ODOO_DB_NAME }}
        --db_host {{ ODOO_DB_HOST }}
        --db_port {{ ODOO_DB_PORT }}
        --db_user {{ ODOO_DB_USER }}
        --stop-after-init
        --no-http
      delegate_to: "{{ ODOO_HOST_NODE }}"
      register: auth_oauth_https_install
      changed_when: "'loading' in (auth_oauth_https_install.stdout ~ auth_oauth_https_install.stderr)"
      failed_when: >-
        auth_oauth_https_install.rc != 0
        or 'invalid module names' in (auth_oauth_https_install.stdout ~ auth_oauth_https_install.stderr)

- name: "πŸ›‘ Fail when Odoo did not install the auth_oauth_https module"
  database_query:
    mask_values: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}"
    config: "{{ lookup('database', application_id) }}"
    query_file: "{{ role_path }}/files/sql/select/installed-module.sql"
    named_args:
      module: "auth_oauth_https"
    expect_rows: true
  register: auth_oauth_https_installed
  failed_when: auth_oauth_https_installed.rows | length == 0
  when: ODOO_OIDC_ENABLED | bool

- name: "πŸ“¦ Install fs_attachment_s3 module for S3 attachment storage"
  no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}"
  shell: > # nocheck: container-exec-resolver  runtime-resolved CID, delegated to the hosting node
    container exec {{ ODOO_LOCAL_CID | quote }}
    odoo -i fs_attachment_s3
    -d {{ ODOO_DB_NAME }}
    --db_host {{ ODOO_DB_HOST }}
    --db_port {{ ODOO_DB_PORT }}
    --db_user {{ ODOO_DB_USER }}
    --stop-after-init
    --no-http
  delegate_to: "{{ ODOO_HOST_NODE }}"
  register: objstore_install
  changed_when: "'loading' in (objstore_install.stdout ~ objstore_install.stderr)"
  failed_when: >-
    objstore_install.rc != 0
    or 'invalid module names' in (objstore_install.stdout ~ objstore_install.stderr)
  when: ODOO_OBJSTORE_ENABLED | bool

- name: "πŸ“¦ Install auth_ldap module for LDAP support"
  no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}"
  shell: > # nocheck: container-exec-resolver  runtime-resolved CID, delegated to the hosting node
    container exec {{ ODOO_LOCAL_CID | quote }}
    odoo -i auth_ldap
    -d {{ ODOO_DB_NAME }}
    --db_host {{ ODOO_DB_HOST }}
    --db_port {{ ODOO_DB_PORT }}
    --db_user {{ ODOO_DB_USER }}
    --stop-after-init
    --no-http
  delegate_to: "{{ ODOO_HOST_NODE }}"
  register: auth_ldap_install
  changed_when: "'loading' in (auth_ldap_install.stdout ~ auth_ldap_install.stderr)"
  failed_when: >-
    auth_ldap_install.rc != 0
    or 'invalid module names' in (auth_ldap_install.stdout ~ auth_ldap_install.stderr)
  when: ODOO_LDAP_ENABLED | bool