container: Support setting container hostname

This commit is contained in:
uumas
2026-03-12 00:12:03 +02:00
parent f721641fc6
commit ff1badbf03
3 changed files with 8 additions and 0 deletions

View File

@@ -6,6 +6,7 @@ container_mounts: []
container_devices: [] container_devices: []
container_publish_ports: [] container_publish_ports: []
container_networks: [] container_networks: []
container_hostname: ""
container_ip: "" container_ip: ""
container_secrets: [] container_secrets: []
container_env: {} container_env: {}

View File

@@ -119,11 +119,17 @@ argument_specs:
required: false required: false
default: [] default: []
elements: str elements: str
container_hostname:
description: Hostname to set inside the container. Available to other containers on the same network.
type: str
required: false
default: ""
container_ip: container_ip:
description: IPv4 address for the container in the first network defined in container_networks description: IPv4 address for the container in the first network defined in container_networks
type: str type: str
required: false required: false
default: "" default: ""
container_secrets: container_secrets:
description: A list of secrets available to the container as file or environment variable description: A list of secrets available to the container as file or environment variable
type: list type: list

View File

@@ -50,6 +50,7 @@
mount: "{{ _container_mounts | map('items') | map('map', 'join', '=') | map('join', ',') }}" mount: "{{ _container_mounts | map('items') | map('map', 'join', '=') | map('join', ',') }}"
device: "{{ _container_devices }}" device: "{{ _container_devices }}"
network: "{{ _container_networks_with_ip }}" network: "{{ _container_networks_with_ip }}"
hostname: "{{ container_hostname or omit }}"
publish: "{{ container_publish_ports }}" publish: "{{ container_publish_ports }}"
secrets: "{{ _container_secrets }}" secrets: "{{ _container_secrets }}"
env: "{{ container_env }}" env: "{{ container_env }}"