Use auth file instead of creds in quadlet files

This commit is contained in:
uumas
2025-10-06 16:17:27 +03:00
parent 2712cf2865
commit bdec55ffc7
12 changed files with 19 additions and 65 deletions

View File

@@ -11,6 +11,3 @@ container_auto_start: true
container_auto_update: true
container_requires: []
container_wants: []
container_image_creds:
username: ""
password: ""

View File

@@ -23,22 +23,6 @@ argument_specs:
description: "The image to run in the container, in FQIN format (registry/imagename:tag)"
type: str
required: true
container_image_creds:
description: Credentials used to authenticate with the registry
type: dict
required: false
default:
username: ""
password: ""
options:
username:
description: Username
type: str
required: true
password:
description: Password
type: str
required: true
container_mounts:
description: List of bind mounts or volumes to be mounted inside the container.

View File

@@ -7,7 +7,6 @@
name: image
vars:
image_name: "{{ container_image }}"
image_creds: "{{ container_image_creds }}"
when: image_created_images is not defined or container_image not in image_created_images
- name: Create networks for container {{ container_name }}
@@ -52,6 +51,7 @@
publish: "{{ container_publish_ports }}"
secrets: "{{ _container_secrets }}"
env: "{{ container_env }}"
label: "{{ _container_labels if _container_labels | length > 0 else omit }}"
state: quadlet
quadlet_file_mode: "0600"
quadlet_options: "{{ _container_quadlet_options }}"

View File

@@ -68,6 +68,15 @@ _container_secrets: >-
| map('join', ',')
}}
_container_labels: >-
{{
{'io.containers.autoupdate.authfile': '/etc/containers/auth.json'}
if container_auto_update and
container_image.split('/')[0] in
podman_registry_accounts | map(attribute='registry')
else {}
}}
_container_quadlet_unit_options: |
[Unit]
Description=Container {{ container_name }}