service: Make supporting containers accessible using simple hostnames

This commit is contained in:
uumas
2026-03-12 00:16:11 +02:00
parent ff1badbf03
commit f6af1d3472
4 changed files with 7 additions and 5 deletions

View File

@@ -244,9 +244,9 @@ argument_specs:
- Database type to set up. - Database type to set up.
- > - >
It will be run in a container accessible to the service at It will be run in a container accessible to the service at
host {{ service_name }}-{{ service_database_type }} on the default port. host <service database type> on the default port.
- The database user will be {{ service_name }} - The database user will be <service name>
- The password will be accessible as secret at /run/secrets/{{ service_database_type }} - The password will be accessible as secret at /run/secrets/<service database type>
- > - >
The password will also be available as the The password will also be available as the
service_podman_secrets['{{ service_name }}-{{ service_database_type }}'] variable. service_podman_secrets['{{ service_name }}-{{ service_database_type }}'] variable.
@@ -293,8 +293,7 @@ argument_specs:
required: false required: false
service_redis: service_redis:
description: >- description: >-
Whether to install redis in a container accessible to the service at host Whether to install redis in a container accessible to the service at host redis.
{{ service_name }}-redis.
type: bool type: bool
required: false required: false
default: false default: false

View File

@@ -13,6 +13,7 @@
container_networks: "{{ _service_container_networks }}" container_networks: "{{ _service_container_networks }}"
container_ip: "{{ _service_additional_container_ip }}" container_ip: "{{ _service_additional_container_ip }}"
container_secrets: "{{ _service_additional_container.secrets | default(_service_container_secrets) }}" container_secrets: "{{ _service_additional_container.secrets | default(_service_container_secrets) }}"
container_hostname: "{{ _service_additional_container.name | regex_replace('^' ~ service_name ~ '-', '') }}"
container_env: "{{ _service_additional_container.env | default(service_container_env) }}" container_env: "{{ _service_additional_container.env | default(service_container_env) }}"
container_requires: "{{ _service_container_requires }}" container_requires: "{{ _service_container_requires }}"
container_wants: "{{ service_wants }}" container_wants: "{{ service_wants }}"

View File

@@ -14,6 +14,7 @@
source: "{{ _service_database_name }}" source: "{{ _service_database_name }}"
destination: "{{ _service_database_mount_destination }}" destination: "{{ _service_database_mount_destination }}"
container_networks: "{{ _service_database_networks }}" container_networks: "{{ _service_database_networks }}"
container_hostname: "{{ service_database_type }}"
container_ip: >- container_ip: >-
{{ service_container_ip | ansible.utils.ipmath(1) if _service_static_ip else '' }} {{ service_container_ip | ansible.utils.ipmath(1) if _service_static_ip else '' }}
container_secrets: container_secrets:

View File

@@ -7,6 +7,7 @@
container_image: docker.io/valkey/valkey:alpine container_image: docker.io/valkey/valkey:alpine
container_networks: container_networks:
- "{{ service_name }}" - "{{ service_name }}"
container_hostname: redis
container_ip: >- container_ip: >-
{{ service_container_ip | ansible.utils.ipmath(2) if _service_static_ip else '' }} {{ service_container_ip | ansible.utils.ipmath(2) if _service_static_ip else '' }}
container_auto_update: "{{ service_auto_update }}" container_auto_update: "{{ service_auto_update }}"