Skip to content

Restart quadlet when mounted host files changed the state #262

@SrX

Description

@SrX

Looking for advice on how to mount host files with configuration into containers, and get restarted containers if changes occur in the configuration files.

In the example below configuration file for caddy mounted properly, but it not reflect later changes on it, since the role cannot detect "dependant" services of the configuration file and restart it.

Is there any workaround for this case or already available configuration model?

- name: Manage caddy via podman quadlet
  hosts: nms
  become: true
  tags:
    - caddy
  vars:
    podman_create_host_directories: true
    podman_quadlet_specs:
      - name: caddy
        file: /opt/nms/Caddyfile
        file_content: |
          {
            auto_https off
          }

          http://127.0.0.1 {
            respond "ok (loopback)" 200
          }

          https://127.0.0.1 {
            tls internal
            respond "ok (loopback)" 200
          }

      - name: caddy
        type: container
        Unit:
          Description: caddy
        Install:
          WantedBy: default.target
        Container:
          Image: "docker.io/caddy:2.10.2"
          ContainerName: caddy
          Network: nms
          Volume: "/opt/nms/Caddyfile:/etc/caddy/Caddyfile:ro"
          PublishPort:
            - 80:80
            - 443:443

  roles:
    - fedora.linux_system_roles.podman

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions