Properly apply default when env lookup returns empty

This commit is contained in:
Yanis Guenane
2021-11-01 15:00:43 +01:00
parent 7eb6d0e0f5
commit fc713e7b73
7 changed files with 10 additions and 10 deletions

View File

@@ -76,7 +76,7 @@
- name: Set Postgres image URL
set_fact:
_postgres_image: "{{ _custom_postgres_image | default(lookup('env', 'RELATED_IMAGE_AWX_POSTGRES')) | default(_default_postgres_image) }}"
_postgres_image: "{{ _custom_postgres_image | default(lookup('env', 'RELATED_IMAGE_AWX_POSTGRES')) | default(_default_postgres_image, true) }}"
- name: Create management pod from templated deployment config
k8s:

View File

@@ -138,7 +138,7 @@ ee_images:
- name: AWX EE (latest)
image: quay.io/ansible/awx-ee:latest
control_plane_ee_image: quay.io/ansible/awx-ee:latest
_control_plane_ee_image: quay.io/ansible/awx-ee:latest
create_preload_data: true

View File

@@ -65,7 +65,7 @@
- name: Set Postgres image URL
set_fact:
_postgres_image: "{{ _custom_postgres_image | default(lookup('env', 'RELATED_IMAGE_AWX_POSTGRES')) | default(_default_postgres_image) }}"
_postgres_image: "{{ _custom_postgres_image | default(lookup('env', 'RELATED_IMAGE_AWX_POSTGRES')) | default(_default_postgres_image, true) }}"
- block:
- name: Create Database configuration

View File

@@ -45,7 +45,7 @@
- name: Set AWX app image URL
set_fact:
_image: "{{ _custom_image | default(lookup('env', 'RELATED_IMAGE_AWX')) | default(_default_image) }}"
_image: "{{ _custom_image | default(lookup('env', 'RELATED_IMAGE_AWX')) | default(_default_image, true) }}"
- name: Set default awx init container image
set_fact:
@@ -60,7 +60,7 @@
- name: Set Init image URL
set_fact:
_init_container_image: "{{ _custom_init_container_image | default(lookup('env', 'RELATED_IMAGE_AWX_INIT_CONTAINER')) | default(_default_init_container_image) }}"
_init_container_image: "{{ _custom_init_container_image | default(lookup('env', 'RELATED_IMAGE_AWX_INIT_CONTAINER')) | default(_default_init_container_image, true) }}"
- name: Set default redis image
set_fact:
@@ -75,7 +75,7 @@
- name: Set Redis image URL
set_fact:
_redis_image: "{{ _custom_redis_image | default(lookup('env', 'RELATED_IMAGE_AWX_REDIS')) | default(_default_redis_image) }}"
_redis_image: "{{ _custom_redis_image | default(lookup('env', 'RELATED_IMAGE_AWX_REDIS')) | default(_default_redis_image, true) }}"
- name: Set user provided control plane ee image
set_fact:
@@ -85,7 +85,7 @@
- name: Set Control Plane EE image URL
set_fact:
_control_plane_ee_image: "{{ _custom_control_plane_ee_image | default(lookup('env', 'RELATED_IMAGE_CONTROL_PLANE_EE')) | default(_control_plane_ee_image) }}"
_control_plane_ee_image: "{{ _custom_control_plane_ee_image | default(lookup('env', 'RELATED_IMAGE_CONTROL_PLANE_EE')) | default(_control_plane_ee_image, true) }}"
- name: Apply deployment resources
k8s:

View File

@@ -70,7 +70,7 @@
name: "{{ ansible_operator_meta.name }}"
namespace: "{{ ansible_operator_meta.namespace }}"
status:
image: "{{ image }}"
image: "{{ _custom_image | default(lookup('env', 'RELATED_IMAGE_AWX')) | default(_default_image, true) }}"
- block:
- name: Retrieve route URL

View File

@@ -3,4 +3,4 @@ GLOBAL_JOB_EXECUTION_ENVIRONMENTS = [
{'name': '{{ item.name }}' , 'image': '{{ item.image }}'},
{% endfor %}
]
CONTROL_PLANE_EXECUTION_ENVIRONMENT = '{{ control_plane_ee_image }}'
CONTROL_PLANE_EXECUTION_ENVIRONMENT = '{{ _control_plane_ee_image }}'

View File

@@ -84,7 +84,7 @@
- name: Set Postgres image URL
set_fact:
_postgres_image: "{{ _custom_postgres_image | default(lookup('env', 'RELATED_IMAGE_AWX_POSTGRES')) | default(_default_postgres_image) }}"
_postgres_image: "{{ _custom_postgres_image | default(lookup('env', 'RELATED_IMAGE_AWX_POSTGRES')) | default(_default_postgres_image, true) }}"
- name: Create management pod from templated deployment config
k8s: