Skip to content
Extraits de code Groupes Projets
Valider da89e608 rédigé par Théo - Le Filament's avatar Théo - Le Filament
Parcourir les fichiers

feat: allow to use tags to trigger only some tasks

parent a37ef6f7
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -8,6 +8,8 @@ ...@@ -8,6 +8,8 @@
mode: '0755' mode: '0755'
- name: Container building requirements - name: Container building requirements
tags:
- "odoo"
when: item.value.image_instance | default(false) == item.key when: item.value.image_instance | default(false) == item.key
block: block:
- name: Create Odoo private docker structure on server in /home/docker/{{ item.key }} - name: Create Odoo private docker structure on server in /home/docker/{{ item.key }}
...@@ -108,6 +110,8 @@ ...@@ -108,6 +110,8 @@
- Build odoo image - Build odoo image
- name: Get image from another instance - name: Get image from another instance
tags:
- "odoo"
when: item.value.image_instance | default(false) != item.key when: item.value.image_instance | default(false) != item.key
block: block:
- name: Check if destination instance image exists - name: Check if destination instance image exists
...@@ -133,6 +137,9 @@ ...@@ -133,6 +137,9 @@
source: local source: local
- name: Copy docker compose service - name: Copy docker compose service
tags:
- "metabase"
- "odoo"
ansible.builtin.template: ansible.builtin.template:
src: docker-compose.yaml.j2 src: docker-compose.yaml.j2
dest: "/home/docker/{{ item.key }}/docker-compose.yml" dest: "/home/docker/{{ item.key }}/docker-compose.yml"
...@@ -146,7 +153,8 @@ ...@@ -146,7 +153,8 @@
# -------------------------------------------------- # --------------------------------------------------
- name: Restore backups from another instance - 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 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: block:
- name: Copy sql script to be run before restoring db from backup_instance - name: Copy sql script to be run before restoring db from backup_instance
ansible.builtin.template: ansible.builtin.template:
...@@ -181,8 +189,9 @@ ...@@ -181,8 +189,9 @@
# prod backup section # prod backup section
# -------------------------------------------------- # --------------------------------------------------
- name: Backup - 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 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: block:
- name: "Copy docker compose for backup account {{ account_index + 1 }}" - name: "Copy docker compose for backup account {{ account_index + 1 }}"
ansible.builtin.template: ansible.builtin.template:
...@@ -212,18 +221,26 @@ ...@@ -212,18 +221,26 @@
# Flush handlers. # Flush handlers.
- name: Set facts - name: Set facts
tags:
- "metabase"
- "odoo"
ansible.builtin.set_fact: ansible.builtin.set_fact:
instance: "{{ {'key': item.key, 'value': item.value} }}" instance: "{{ {'key': item.key, 'value': item.value} }}"
instance_odoo_version: "{{ instance_odoo_setup.odoo_version }}" instance_odoo_version: "{{ instance_odoo_setup.odoo_version }}"
cacheable: false cacheable: false
- name: Flush handlers - name: Flush handlers
tags:
- "metabase"
- "odoo"
ansible.builtin.meta: flush_handlers ansible.builtin.meta: flush_handlers
# -------------------------------------------------- # --------------------------------------------------
# Postgres Readonly user # Postgres Readonly user
# -------------------------------------------------- # --------------------------------------------------
- name: Postgres Read-only user - name: Postgres Read-only user
tags:
- "db_remote_ro_user"
when: item.value.odoo_remote_db_access | default(false) when: item.value.odoo_remote_db_access | default(false)
block: block:
- name: Allow readonly user connection to prod db (with userns_remap) - name: Allow readonly user connection to prod db (with userns_remap)
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
# -------------------------------------------------- # --------------------------------------------------
- name: Copy docker compose for whitelists - name: Copy docker compose for whitelists
tags: "whitelists"
ansible.builtin.template: ansible.builtin.template:
src: whitelists.yaml.j2 src: whitelists.yaml.j2
dest: "/home/docker/whitelists.yaml" dest: "/home/docker/whitelists.yaml"
...@@ -14,10 +15,11 @@ ...@@ -14,10 +15,11 @@
when: restrict_internet_access and whitelisted_urls | default([]) when: restrict_internet_access and whitelisted_urls | default([])
- name: NON-PROD instance setup - name: NON-PROD instance setup
tags:
- "always"
- "odoo_nonprod"
ansible.builtin.include_tasks: ansible.builtin.include_tasks:
file: instance.yml file: instance.yml
apply:
tags: backup_odoo
with_dict: "{{ odoo_instances }}" with_dict: "{{ odoo_instances }}"
loop_control: loop_control:
label: "{{ item.key }}" label: "{{ item.key }}"
...@@ -26,10 +28,11 @@ ...@@ -26,10 +28,11 @@
when: not (item.value.prod_instance | default(false) == item.key) and (odoo_instance is undefined or item.key == odoo_instance) when: not (item.value.prod_instance | default(false) == item.key) and (odoo_instance is undefined or item.key == odoo_instance)
- name: PROD instance setup - name: PROD instance setup
tags:
- "always"
- "odoo_prod"
ansible.builtin.include_tasks: ansible.builtin.include_tasks:
file: instance.yml file: instance.yml
apply:
tags: backup_odoo
with_dict: "{{ odoo_instances }}" with_dict: "{{ odoo_instances }}"
loop_control: loop_control:
label: "{{ item.key }}" label: "{{ item.key }}"
...@@ -41,6 +44,7 @@ ...@@ -41,6 +44,7 @@
# Remote imports section # Remote imports section
# -------------------------------------------------- # --------------------------------------------------
- name: Remote Imports - name: Remote Imports
tags: "remote_imports"
block: block:
- name: Push private keys for any external tool connection - name: Push private keys for any external tool connection
when: private_keys is defined when: private_keys is defined
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter