diff --git a/tasks/instance.yml b/tasks/instance.yml index 1d3d95d37cd8630c90a2be37e26092296d001dc5..e84704e72a1bf7b2277707d299558b51f5054699 100644 --- a/tasks/instance.yml +++ b/tasks/instance.yml @@ -8,6 +8,8 @@ mode: '0755' - name: Container building requirements + tags: + - "odoo" when: item.value.image_instance | default(false) == item.key block: - name: Create Odoo private docker structure on server in /home/docker/{{ item.key }} @@ -108,6 +110,8 @@ - Build odoo image - name: Get image from another instance + tags: + - "odoo" when: item.value.image_instance | default(false) != item.key block: - name: Check if destination instance image exists @@ -133,6 +137,9 @@ source: local - name: Copy docker compose service + tags: + - "metabase" + - "odoo" ansible.builtin.template: src: docker-compose.yaml.j2 dest: "/home/docker/{{ item.key }}/docker-compose.yml" @@ -146,7 +153,8 @@ # -------------------------------------------------- - name: Restore backups from another instance when: (item.value.backup_instance | default(item.key) != item.key or item.value.backup_host | default(inventory_hostname) != inventory_hostname) and inventory_hostname in groups.maintenance_contract - tags: 'backup_odoo' + tags: + - "backup_odoo" block: - name: Copy sql script to be run before restoring db from backup_instance ansible.builtin.template: @@ -181,8 +189,9 @@ # prod backup section # -------------------------------------------------- - name: Backup + tags: + - "backup_odoo" when: item.value.backup_instance | default(false) == item.key and item.value.backup_host | default(inventory_hostname) == inventory_hostname and inventory_hostname in groups.maintenance_contract - tags: 'backup_odoo' block: - name: "Copy docker compose for backup account {{ account_index + 1 }}" ansible.builtin.template: @@ -212,18 +221,26 @@ # Flush handlers. - name: Set facts + tags: + - "metabase" + - "odoo" ansible.builtin.set_fact: instance: "{{ {'key': item.key, 'value': item.value} }}" instance_odoo_version: "{{ instance_odoo_setup.odoo_version }}" cacheable: false - name: Flush handlers + tags: + - "metabase" + - "odoo" ansible.builtin.meta: flush_handlers # -------------------------------------------------- # Postgres Readonly user # -------------------------------------------------- - name: Postgres Read-only user + tags: + - "db_remote_ro_user" when: item.value.odoo_remote_db_access | default(false) block: - name: Allow readonly user connection to prod db (with userns_remap) diff --git a/tasks/main.yml b/tasks/main.yml index 3e32ade64c2c6d4997bdf788d7fc6a90ccbc638e..ffb24786a4873b03c7a31afa6b06e8a01b0edd27 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -4,6 +4,7 @@ # -------------------------------------------------- - name: Copy docker compose for whitelists + tags: "whitelists" ansible.builtin.template: src: whitelists.yaml.j2 dest: "/home/docker/whitelists.yaml" @@ -14,10 +15,11 @@ when: restrict_internet_access and whitelisted_urls | default([]) - name: NON-PROD instance setup + tags: + - "always" + - "odoo_nonprod" ansible.builtin.include_tasks: file: instance.yml - apply: - tags: backup_odoo with_dict: "{{ odoo_instances }}" loop_control: label: "{{ item.key }}" @@ -26,10 +28,11 @@ when: not (item.value.prod_instance | default(false) == item.key) and (odoo_instance is undefined or item.key == odoo_instance) - name: PROD instance setup + tags: + - "always" + - "odoo_prod" ansible.builtin.include_tasks: file: instance.yml - apply: - tags: backup_odoo with_dict: "{{ odoo_instances }}" loop_control: label: "{{ item.key }}" @@ -41,6 +44,7 @@ # Remote imports section # -------------------------------------------------- - name: Remote Imports + tags: "remote_imports" block: - name: Push private keys for any external tool connection when: private_keys is defined