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

View File

@@ -13,6 +13,7 @@
container_networks: "{{ _service_container_networks }}"
container_ip: "{{ _service_additional_container_ip }}"
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_requires: "{{ _service_container_requires }}"
container_wants: "{{ service_wants }}"

View File

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

View File

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