containers.podman.podman_quadlet module – Install or remove Podman Quadlets
Note
This module is part of the containers.podman collection (version 1.19.0).
You might already have this collection installed if you are using the ansible package.
It is not included in ansible-core.
To check whether it is installed, run ansible-galaxy collection list.
To install it, use: ansible-galaxy collection install containers.podman.
You need further requirements to be able to use this module,
see Requirements for details.
To use it in a playbook, specify: containers.podman.podman_quadlet.
Synopsis
Install or remove Podman Quadlets using
podman quadlet installandpodman quadlet rm.Creation of quadlet files is handled by resource modules with state=quadlet.
Updates are handled by removing the existing quadlet and installing the new one.
Idempotency for local sources uses Podman’s .app/.asset manifest files and direct content comparison.
For remote URLs, the module always reinstalls to ensure the host matches the configured source (reports changed=true).
Supports
.quadletsfiles containing multiple quadlet sections separated by---delimiter (requires Podman 6.0+).Each section in a
.quadletsfile must include a# FileName=<name>comment to specify the output filename.
Requirements
The below requirements are needed on the host that executes this module.
podman
Parameters
Parameter |
Comments |
|---|---|
Remove all installed quadlets when state=absent (maps to Choices:
|
|
Extra global arguments to pass to the These are placed after the executable and before the subcommand. |
|
Return additional information which can be helpful for investigations. Choices:
|
|
Path to Default: |
|
Additional non-quadlet files or URLs to install along with the primary src (quadlet application use-case). Passed positionally to For local files, full idempotency is provided. If any file is a URL, the entire install always reports |
|
Force removal when state=absent (maps to Choices:
|
|
Name (filename without path) of an installed quadlet to remove when state=absent. If the name does not include the type suffix (e.g. |
|
Override the target quadlet directory used for idempotency checks. By default it follows Podman defaults.
Note this is used for content comparison only and is not passed to Podman. |
|
Control systemd reload behavior in Podman. When true, pass When false, pass Choices:
|
|
Path to a quadlet file, a directory containing a quadlet application, or a URL to install when state=present. For local files and directories, full idempotency is provided (content comparison). For remote URLs, the module always installs fresh and reports Directory installs support only top-level files; nested subdirectories will cause an error. |
|
Desired state of quadlet(s). Choices:
|
Examples
- name: Install a simple quadlet file
containers.podman.podman_quadlet:
state: present
src: /tmp/myapp.container
- name: Install a quadlet application with additional config files
containers.podman.podman_quadlet:
state: present
src: /tmp/myapp.container
files:
- /tmp/myapp.conf
- /tmp/secrets.env
- name: Install quadlet application from a directory
containers.podman.podman_quadlet:
state: present
src: /tmp/myapp_dir/
- name: Install with custom quadlet directory (e.g. for system-wide install)
containers.podman.podman_quadlet:
state: present
src: /tmp/myapp.container
quadlet_dir: /etc/containers/systemd
become: true
- name: Remove a specific quadlet
containers.podman.podman_quadlet:
state: absent
name:
- myapp.container
- name: Remove multiple quadlets
containers.podman.podman_quadlet:
state: absent
name:
- myapp.container
- database.container
- cache.container
- name: Remove quadlet without suffix (module resolves to .container, .pod, etc.)
containers.podman.podman_quadlet:
state: absent
name:
- myapp
- name: Remove all quadlets (use with caution)
containers.podman.podman_quadlet:
state: absent
all: true
- name: Install quadlet from a URL (always reports changed=true)
containers.podman.podman_quadlet:
state: present
src: https://example.com/myapp.container
- name: Install multi-quadlet application from .quadlets file (Podman 6.0+)
containers.podman.podman_quadlet:
state: present
src: /tmp/webapp.quadlets
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
|---|---|
List of currently installed files detected from Podman manifests Returned: when debug=true and state=present and mode is not remote |
|
Internal specification used for idempotency detection Returned: when debug=true and state=present |
|
List of filenames that should be installed Returned: success |
|
The .app or .asset marker filename used by Podman Returned: success |
|
Install mode (dir_app, quadlets_app, single_file, or remote) Returned: success |
|
What will be passed to ‘podman quadlet rm’ for updates Returned: success |
|
Human-readable actions performed Returned: always |
|
Whether any change was made Returned: always |
|
Executed podman command lines Returned: always |
|
List of affected quadlets with name, path, and scope Returned: always |
|
podman stderr Returned: when debug=true |
|
podman stdout Returned: when debug=true |