Skip to content
Extraits de code Groupes Projets
Valider 21263d6b rédigé par Rémi - Le Filament's avatar Rémi - Le Filament
Parcourir les fichiers

[UPD] replace is defined by default()

parent db3814c5
Branches
Étiquettes v1.2.2
Aucune requête de fusion associée trouvée
...@@ -10,21 +10,21 @@ ...@@ -10,21 +10,21 @@
name: lefilament/odoo:{{ instance_odoo_version }}_ml name: lefilament/odoo:{{ instance_odoo_version }}_ml
source: pull source: pull
force_source: true force_source: true
when: not ansible_check_mode and instance.value.odoo_multilingual is defined and instance.value.odoo_multilingual when: not ansible_check_mode and instance.value.odoo_multilingual | default(false)
- name: pull odoo Python3.6 image - name: pull odoo Python3.6 image
docker_image: docker_image:
name: lefilament/odoo:{{ instance_odoo_version }}_py3.6 name: lefilament/odoo:{{ instance_odoo_version }}_py3.6
source: pull source: pull
force_source: true force_source: true
when: not ansible_check_mode and instance.value.odoo_python36 is defined and instance.value.odoo_python36 when: not ansible_check_mode and instance.value.odoo_python36 | default(false)
- name: pull odoo image - name: pull odoo image
docker_image: docker_image:
name: lefilament/odoo:{{ instance_odoo_version }} name: lefilament/odoo:{{ instance_odoo_version }}
source: pull source: pull
force_source: true force_source: true
when: not ansible_check_mode and (instance.value.odoo_multilingual is not defined or not instance.value.odoo_multilingual) and (instance.value.odoo_python36 is not defined or not instance.value.odoo_python36) when: not ansible_check_mode and not (instance.value.odoo_multilingual | default(false) or instance.value.odoo_python36 | default(false))
- name: build odoo image - name: build odoo image
docker_compose: docker_compose:
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
mode: '0755' mode: '0755'
- name: container building requirements - name: container building requirements
when: (item.value.need_build is not defined and item.value.is_prod is defined and not item.value.is_prod) or (item.value.need_build is defined and item.value.need_build) when: item.value.need_build | default(false)
tags: ['never', 'build_odoo'] tags: ['never', 'build_odoo']
block: block:
- name: create Odoo docker structure on server in /home/docker/{{ item.key }}/odoo/private - name: create Odoo docker structure on server in /home/docker/{{ item.key }}/odoo/private
...@@ -92,7 +92,7 @@ ...@@ -92,7 +92,7 @@
owner: root owner: root
group: root group: root
mode: '0400' mode: '0400'
when: git_private_keys is defined when: git_private_keys | default(false)
notify: build odoo image notify: build odoo image
- name: copy Dockerfile to retrieve private repos and extra OCA ones - name: copy Dockerfile to retrieve private repos and extra OCA ones
...@@ -109,7 +109,7 @@ ...@@ -109,7 +109,7 @@
- build odoo image - build odoo image
- name: PROD set image - name: PROD set image
when: item.value.is_prod is defined and item.value.is_prod and item.value.from_instance is defined when: item.value.is_prod | default(false) and item.value.from_instance is defined
block: block:
- name: PROD check if prod image exists - name: PROD check if prod image exists
docker_image_info: docker_image_info:
...@@ -130,7 +130,7 @@ ...@@ -130,7 +130,7 @@
owner: root owner: root
group: root group: root
mode: '0400' mode: '0400'
when: item.value.is_prod is defined and item.value.is_prod when: item.value.is_prod | default(false)
notify: start odoo container notify: start odoo container
- name: copy test docker-compose service - name: copy test docker-compose service
...@@ -140,14 +140,14 @@ ...@@ -140,14 +140,14 @@
owner: root owner: root
group: root group: root
mode: '0400' mode: '0400'
when: item.value.is_prod is undefined or not item.value.is_prod when: not (item.value.is_prod | default(false))
notify: start odoo container notify: start odoo container
# -------------------------------------------------- # --------------------------------------------------
# non-prod restore section # non-prod restore section
# -------------------------------------------------- # --------------------------------------------------
- name: non-prod restore - name: non-prod restore
when: (item.value.is_prod is undefined or not item.value.is_prod) and inventory_hostname in groups.maintenance_contract when: not (item.value.is_prod | default(false)) and inventory_hostname in groups.maintenance_contract
tags: 'backup_odoo' tags: 'backup_odoo'
block: block:
- name: NONPROD copy sql script to be run before restoring db from prod - name: NONPROD copy sql script to be run before restoring db from prod
...@@ -182,7 +182,7 @@ ...@@ -182,7 +182,7 @@
# prod backup section # prod backup section
# -------------------------------------------------- # --------------------------------------------------
- name: prod backup - name: prod backup
when: item.value.is_prod is defined and item.value.is_prod and inventory_hostname in groups.maintenance_contract when: item.value.is_prod | default(false) and inventory_hostname in groups.maintenance_contract
tags: 'backup_odoo' tags: 'backup_odoo'
block: block:
- name: PROD copy docker compose for backups - name: PROD copy docker compose for backups
...@@ -215,7 +215,7 @@ ...@@ -215,7 +215,7 @@
# Remote imports section # Remote imports section
# -------------------------------------------------- # --------------------------------------------------
- name: prod import - name: prod import
when: item.value.is_prod is defined and item.value.is_prod and inventory_hostname in groups.maintenance_contract when: item.value.is_prod | default(false) and inventory_hostname in groups.maintenance_contract
block: block:
- name: PROD Push private keys for any external tool connection - name: PROD Push private keys for any external tool connection
copy: copy:
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
group: root group: root
mode: '0400' mode: '0400'
notify: start odoo whitelists notify: start odoo whitelists
when: restrict_internet_access and whitelisted_urls is defined when: restrict_internet_access and whitelisted_urls | default([])
tags: odoo_nonprod, odoo_prod tags: odoo_nonprod, odoo_prod
- name: non-prod intance setup - name: non-prod intance setup
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
label: "{{ item.key }}" label: "{{ item.key }}"
vars: vars:
instance_odoo_setup: "{{ odoo_setup_conf[item.value.odoo_setup_version | default(odoo_setup_version)] }}" instance_odoo_setup: "{{ odoo_setup_conf[item.value.odoo_setup_version | default(odoo_setup_version)] }}"
when: (item.value.is_prod is not defined or not item.value.is_prod) and (odoo_instance is undefined or item.key == odoo_instance) when: not (item.value.is_prod | default(false)) and (odoo_instance is undefined or item.key == odoo_instance)
- name: prod intance setup - name: prod intance setup
include_tasks: instance.yml include_tasks: instance.yml
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
label: "{{ item.key }}" label: "{{ item.key }}"
vars: vars:
instance_odoo_setup: "{{ odoo_setup_conf[item.value.odoo_setup_version | default(odoo_setup_version)] }}" instance_odoo_setup: "{{ odoo_setup_conf[item.value.odoo_setup_version | default(odoo_setup_version)] }}"
when: (item.value.is_prod is defined and item.value.is_prod) and (odoo_instance is undefined or item.key == odoo_instance) when: item.value.is_prod | default(false) and (odoo_instance is undefined or item.key == odoo_instance)
# -------------------------------------------------- # --------------------------------------------------
# Postgres Readonly user # Postgres Readonly user
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
host {{ odoo_prod.db }} {{ odoo_prod.db_user }} 172.16.0.0/12 md5 host {{ odoo_prod.db }} {{ odoo_prod.db_user }} 172.16.0.0/12 md5
host postgres {{ odoo_prod.db_user }} 172.16.0.0/12 md5 host postgres {{ odoo_prod.db_user }} 172.16.0.0/12 md5
host {{ odoo_prod.db }} {{ odoo_db_rouser }} all md5 host {{ odoo_prod.db }} {{ odoo_db_rouser }} all md5
when: odoo_remote_db_access and odoo_prod is defined and docker_userns_remap when: odoo_remote_db_access and odoo_prod | default(false) and docker_userns_remap
tags: odoo_prod tags: odoo_prod
- name: PROD Allow readonly user connection to prod db (no userns_remap) - name: PROD Allow readonly user connection to prod db (no userns_remap)
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
host {{ odoo_prod.db }} {{ odoo_prod.db_user }} 172.16.0.0/12 md5 host {{ odoo_prod.db }} {{ odoo_prod.db_user }} 172.16.0.0/12 md5
host postgres {{ odoo_prod.db_user }} 172.16.0.0/12 md5 host postgres {{ odoo_prod.db_user }} 172.16.0.0/12 md5
host {{ odoo_prod.db }} {{ odoo_db_rouser }} all md5 host {{ odoo_prod.db }} {{ odoo_db_rouser }} all md5
when: odoo_remote_db_access and odoo_prod is defined and not docker_userns_remap when: odoo_remote_db_access and odoo_prod | default(false) and not docker_userns_remap
tags: odoo_prod tags: odoo_prod
- name: PROD Disable access all rights (with userns_remap) - name: PROD Disable access all rights (with userns_remap)
...@@ -63,7 +63,7 @@ ...@@ -63,7 +63,7 @@
name: "/var/lib/docker/{{ dockremap_subuid }}.{{ dockremap_subgid }}/volumes/odoo_db/_data/pg_hba.conf" name: "/var/lib/docker/{{ dockremap_subuid }}.{{ dockremap_subgid }}/volumes/odoo_db/_data/pg_hba.conf"
regexp: "^host all all all md5" regexp: "^host all all all md5"
line: "#host all all all md5" line: "#host all all all md5"
when: odoo_remote_db_access and odoo_prod is defined and docker_userns_remap when: odoo_remote_db_access and odoo_prod | default(false) and docker_userns_remap
tags: odoo_prod tags: odoo_prod
- name: PROD Disable access all rights (no userns_remap) - name: PROD Disable access all rights (no userns_remap)
...@@ -71,5 +71,5 @@ ...@@ -71,5 +71,5 @@
name: /var/lib/docker/volumes/odoo_db/_data/pg_hba.conf name: /var/lib/docker/volumes/odoo_db/_data/pg_hba.conf
regexp: "^host all all all md5" regexp: "^host all all all md5"
line: "#host all all all md5" line: "#host all all all md5"
when: odoo_remote_db_access and odoo_prod is defined and not docker_userns_remap when: odoo_remote_db_access and odoo_prod | default(false) and not docker_userns_remap
tags: odoo_prod tags: odoo_prod
## Image to get git repos ## Image to get git repos
FROM lefilament/odoo:{{ instance_odoo_setup.odoo_version }}{% if item.value.odoo_python36 is defined and item.value.odoo_python36 %}_py3.6{% endif %}{% if item.value.odoo_multilingual is defined and item.value.odoo_multilingual %}_ml{% endif %} as odoo_addons FROM lefilament/odoo:{{ instance_odoo_setup.odoo_version }}{% if item.value.odoo_python36 | default(false) %}_py3.6{% endif %}{% if item.value.odoo_multilingual | default(false) %}_ml{% endif %} as odoo_addons
LABEL stage=builder LABEL stage=builder
USER root USER root
# Install GitLab private keys # Install GitLab private keys
...@@ -16,7 +16,7 @@ RUN /opt/odoo/private/fetch_repos_addons ...@@ -16,7 +16,7 @@ RUN /opt/odoo/private/fetch_repos_addons
RUN /opt/odoo/private/fetch_repos RUN /opt/odoo/private/fetch_repos
## Final image ## Final image
FROM lefilament/odoo:{{ instance_odoo_setup.odoo_version }}{% if item.value.odoo_python36 is defined and item.value.odoo_python36 %}_py3.6{% endif %}{% if item.value.odoo_multilingual is defined and item.value.odoo_multilingual %}_ml{% endif %} as final FROM lefilament/odoo:{{ instance_odoo_setup.odoo_version }}{% if item.value.odoo_python36 | default(false) %}_py3.6{% endif %}{% if item.value.odoo_multilingual | default(false) %}_ml{% endif %} as final
USER root USER root
COPY --from=odoo_addons --chown=odoo:odoo /opt/odoo/private_addons /opt/odoo/private_addons COPY --from=odoo_addons --chown=odoo:odoo /opt/odoo/private_addons /opt/odoo/private_addons
COPY --from=odoo_addons --chown=odoo:odoo /opt/odoo/additional_addons /opt/odoo/additional_addons COPY --from=odoo_addons --chown=odoo:odoo /opt/odoo/additional_addons /opt/odoo/additional_addons
......
...@@ -23,7 +23,7 @@ services: ...@@ -23,7 +23,7 @@ services:
volumes: volumes:
- {{ item.key }}{{ account.key }}_backup_cache:/root/.cache/duplicity/:z - {{ item.key }}{{ account.key }}_backup_cache:/root/.cache/duplicity/:z
- {{ item.key }}_filestore:/mnt/backup/src/odoo:z - {{ item.key }}_filestore:/mnt/backup/src/odoo:z
{% if item.value.metabase is defined and item.value.metabase %} {% if item.value.metabase | default(false) %}
- {{ item.key }}_metabase:/mnt/backup/src/metabase:z - {{ item.key }}_metabase:/mnt/backup/src/metabase:z
{% endif %} {% endif %}
networks: networks:
...@@ -43,7 +43,7 @@ volumes: ...@@ -43,7 +43,7 @@ volumes:
{{ item.key }}{{ account.key }}_backup_cache: {{ item.key }}{{ account.key }}_backup_cache:
{{ item.key }}_filestore: {{ item.key }}_filestore:
external: true external: true
{% if item.value.metabase is defined and item.value.metabase %} {% if item.value.metabase | default(false) %}
{{ item.key }}_metabase: {{ item.key }}_metabase:
external: true external: true
{% endif %} {% endif %}
version: "2.1" version: "2.1"
services: services:
odoo: odoo:
{% if item.value.need_build is defined and item.value.need_build %} {% if item.value.need_build | default(false) %}
build: build:
context: ./odoo context: ./odoo
{% endif %} {% endif %}
...@@ -69,7 +69,7 @@ services: ...@@ -69,7 +69,7 @@ services:
{% endif %} {% endif %}
labels: labels:
co.elastic.logs/module: postgresql co.elastic.logs/module: postgresql
{% if item.value.odoo_remote_db_access is defined and item.value.odoo_remote_db_access %} {% if item.value.odoo_remote_db_access | default(false) %}
networks: networks:
default: default:
public: public:
...@@ -162,7 +162,7 @@ services: ...@@ -162,7 +162,7 @@ services:
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if item.value.metabase is defined and item.value.metabase %} {% if item.value.metabase | default(false) %}
metabase: metabase:
image: metabase/metabase image: metabase/metabase
container_name: {{ item.key }}_metabase container_name: {{ item.key }}_metabase
...@@ -212,7 +212,7 @@ networks: ...@@ -212,7 +212,7 @@ networks:
inverseproxy_app: inverseproxy_app:
external: true external: true
{% endif %} {% endif %}
{% if item.value.metabase is defined and item.value.metabase %} {% if item.value.metabase | default(false) %}
inverseproxy_bi: inverseproxy_bi:
external: true external: true
{% endif %} {% endif %}
...@@ -242,7 +242,7 @@ networks: ...@@ -242,7 +242,7 @@ networks:
encrypted: 1 encrypted: 1
{% endif %} {% endif %}
{% endif %} {% endif %}
{% if item.value.odoo_remote_db_access is defined and item.value.odoo_remote_db_access %} {% if item.value.odoo_remote_db_access | default(false) %}
public: public:
{% endif %} {% endif %}
...@@ -252,6 +252,6 @@ volumes: ...@@ -252,6 +252,6 @@ volumes:
{% if mailname is defined %} {% if mailname is defined %}
smtp: smtp:
{% endif %} {% endif %}
{% if item.value.metabase is defined and item.value.metabase %} {% if item.value.metabase | default(false) %}
metabase: metabase:
{% endif %} {% endif %}
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