mirror of
https://github.com/famedly/ansible-collection-base
synced 2024-11-10 06:24:17 +00:00
chore(postgresql): migrate to standardized container image variable structure
This commit is contained in:
parent
ee42621a3c
commit
6e455089e4
4 changed files with 29 additions and 12 deletions
|
@ -34,11 +34,11 @@ This is an example for specifying the official PostGIS image:
|
|||
```yaml
|
||||
postgresql_version: "13"
|
||||
postgis_version: "3.1"
|
||||
postgresql_container_image_name: "docker.io/postgis/postgis"
|
||||
postgresql_container_image_repository: "docker.io/postgis/postgis"
|
||||
postgresql_container_image_tag: "{{ postgresql_version }}-{{ postgis_version }}-{{ postgresql_container_distro }}"
|
||||
```
|
||||
|
||||
You could also override the entire `postgresql_container_image` variable.
|
||||
You could also override the entire `postgresql_container_image_reference` variable.
|
||||
|
||||
## Dependencies
|
||||
Docker needs to be installed and configured.
|
||||
|
|
|
@ -6,17 +6,34 @@ postgresql_socket_path: "{{ postgresql_base_path }}/sockets"
|
|||
postgresql_config_path: "{{ postgresql_base_path }}/config"
|
||||
postgresql_connect_socket: true
|
||||
|
||||
postgresql_container_image_name: "docker.io/postgres"
|
||||
postgresql_container_version: "13.4"
|
||||
postgresql_container_distro: "alpine"
|
||||
postgresql_container_image_tag: >-
|
||||
|
||||
postgresql_container_image_reference: >-
|
||||
{{
|
||||
postgresql_container_version
|
||||
}}{{
|
||||
('-' + postgresql_container_distro) if postgresql_container_distro else ''
|
||||
postgresql_container_image_repository
|
||||
+ ':'
|
||||
+ postgresql_container_image_tag | default(
|
||||
postgresql_container_version
|
||||
+ (('-' + postgresql_container_distro)
|
||||
if postgresql_container_distro
|
||||
else ''
|
||||
)
|
||||
)
|
||||
}}
|
||||
postgresql_container_image: >-
|
||||
{{ postgresql_container_image_name }}:{{ postgresql_container_image_tag }}
|
||||
postgresql_container_image_repository: >-
|
||||
{{
|
||||
(
|
||||
container_registries[postgresql_container_image_registry]
|
||||
| default(postgresql_container_image_registry)
|
||||
)
|
||||
+ '/'
|
||||
+ postgresql_container_image_namespace | default('')
|
||||
+ postgresql_container_image_name
|
||||
}}
|
||||
postgresql_container_image_registry: "docker.io"
|
||||
postgresql_container_image_name: "postgres"
|
||||
|
||||
postgresql_container_name: "postgresql"
|
||||
postgresql_container_labels: {}
|
||||
postgresql_container_ports: >-
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
- name: "Initialize PostgreSQL container"
|
||||
community.docker.docker_container:
|
||||
name: "{{ postgresql_container_name }}"
|
||||
image: "{{ postgresql_container_image }}"
|
||||
image: "{{ postgresql_container_image_reference }}"
|
||||
ports: "{{ postgresql_container_ports }}"
|
||||
volumes: "{{ postgresql_container_init_volumes }}"
|
||||
labels: "{{ postgresql_container_labels_complete }}"
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
- name: "Ensure PostgreSQL container image is pulled"
|
||||
community.docker.docker_image:
|
||||
name: "{{ postgresql_container_image }}"
|
||||
name: "{{ postgresql_container_image_reference }}"
|
||||
force_source: "{{ postgresql_container_pull }}"
|
||||
source: "pull"
|
||||
state: "present"
|
||||
|
@ -89,7 +89,7 @@
|
|||
- name: "Ensure PostgreSQL container is started"
|
||||
community.docker.docker_container:
|
||||
name: "{{ postgresql_container_name }}"
|
||||
image: "{{ postgresql_container_image }}"
|
||||
image: "{{ postgresql_container_image_reference }}"
|
||||
ports: "{{ postgresql_container_ports }}"
|
||||
volumes: "{{ postgresql_container_volumes_complete }}"
|
||||
labels: "{{ postgresql_container_labels_complete }}"
|
||||
|
|
Loading…
Reference in a new issue