chore(redis): migrate to standardized container image variable structure

This commit is contained in:
Jan Christian Grünhage 2023-03-10 10:27:44 +01:00
parent 6e455089e4
commit ce8d3cd082
2 changed files with 25 additions and 5 deletions

View file

@ -18,8 +18,28 @@ redis_config_max_memory_policy: ~ # allkeys-lru
redis_prefix: ""
redis_docker_labels: {}
redis_docker_configpath: "/usr/local/etc/redis/redis.conf"
redis_docker_image: "docker.io/library/redis:{{ redis_docker_tag }}"
redis_docker_tag: "{{ redis_version }}-alpine"
redis_container_image_reference: >-
{{
redis_container_image_repository
+ ':'
+ redis_container_image_tag | default(redis_version + '-alpine')
}}
redis_container_image_repository: >-
{{
(
container_registries[redis_container_image_registry]
| default(redis_container_image_registry)
)
+ '/'
+ redis_container_image_namespace | default('')
+ redis_container_image_name
}}
redis_container_image_registry: "docker.io"
redis_container_image_name: "redis"
redis_container_image_force_pull: "{{ redis_container_image_tag is defined }}"
redis_docker_container_name: "{{ redis_prefix }}redis"
redis_docker_ports: ["6379:6379"]
redis_docker_networks: ~

View file

@ -46,15 +46,15 @@
- name: "Ensure redis container image is present"
community.docker.docker_image:
name: "{{ redis_docker_image }}"
force_source: "{{ redis_docker_image_force_pull | default(False) }}"
name: "{{ redis_container_image_reference }}"
force_source: "{{ redis_container_image_force_pull }}"
source: "pull"
state: "present"
tags: ["prepare", "prepare-redis"]
- name: "Setup redis docker container"
community.docker.docker_container:
image: "{{ redis_docker_image }}"
image: "{{ redis_container_image_reference }}"
name: "{{ redis_docker_container_name }}"
restart_policy: "unless-stopped"
user: "{{ redis_user_res.uid }}:{{ redis_user_res.group }}"