1
0
Fork 0
mirror of https://github.com/containers/ansible-podman-collections.git synced 2026-06-29 23:49:12 +00:00
Commit graph

394 commits

Author SHA1 Message Date
Sergey
efa337c536
Fix podman_network not idempotent with IPv6 addresses, fix #1041 (#1042)
* Fix podman_network not idempotent with IPv6 addresses, fix #1041

Normalize IPv6 addresses and subnets before comparing in diff methods
using Python's ipaddress module. Different notations of the same IPv6
address (e.g. "::1" vs "0:1") are now correctly recognized as equal,
preventing unnecessary network recreation.

- Guard _normalize_ip/_normalize_subnet with HAS_IP_ADDRESS_MODULE check
- Normalize user-supplied route strings in diffparam_route
- Keep _lease_range_to_str as @staticmethod
- Catch TypeError in _normalize_ip/_normalize_subnet for None inputs
- Use .get("gateway") with filter in multi-gateway join to avoid KeyError
- Fix implicit string concatenation lint warnings
---------

Signed-off-by: Sagi Shnaidman <sshnaidm@redhat.com>
2026-06-17 16:33:31 +03:00
Benjamin MENANT
f13e89b146
Fix podman_image build ignoring arch (#802) (#1036)
Signed-off-by: Benjamin Menant <dev@menant-benjamin.fr>
2026-05-28 16:33:12 +03:00
Sergey
70c7c93acc
Add support for aliases for Quadlets (#1035)
Signed-off-by: Sagi Shnaidman <sshnaidm@redhat.com>
2026-05-20 10:18:51 +03:00
Sergey
1436647bc3
Release 1.20.0 version (#1030)
Fix typos and release.

Signed-off-by: Sagi Shnaidman <sshnaidm@redhat.com>
2026-05-04 15:00:49 +03:00
Sergey
16ad7de649
Fix podman_quadlet_build and write unittests (#1027)
Signed-off-by: Sagi Shnaidman <sshnaidm@redhat.com>
2026-04-29 19:57:15 +03:00
BenjaminVouillaume
983c6faeb3
feat: Create podman_build modules to build using quadlet (#1008)
* feat: Create podman_build modules to build using quadlet

Signed-off-by: Benjamin Vouillaume <benjamin.m.vouillaume@gmail.com>
Signed-off-by: Benjamin Vouillaume <benjaminvouillaume@MacBook-Pro-de-Benjamin.local>
Signed-off-by: BenjaminVouillaume <benjaminvouillaume@MacBook-Pro-de-Benjamin.local>
Signed-off-by: BenjaminVouillaume <benjamin.m.vouillaume@gmail.com>

* fix: tests

Signed-off-by: Benjamin Vouillaume <benjamin.m.vouillaume@gmail.com>
Signed-off-by: Benjamin Vouillaume <benjaminvouillaume@MacBook-Pro-de-Benjamin.local>
Signed-off-by: BenjaminVouillaume <benjaminvouillaume@MacBook-Pro-de-Benjamin.local>
Signed-off-by: BenjaminVouillaume <benjamin.m.vouillaume@gmail.com>

* chore: Small fixes based on review

Signed-off-by: BenjaminVouillaume <benjamin.m.vouillaume@gmail.com>

* fix: Gemini second review

Signed-off-by: BenjaminVouillaume <benjamin.m.vouillaume@gmail.com>

* fix: Sergey's review

Signed-off-by: BenjaminVouillaume <benjamin.m.vouillaume@gmail.com>

---------

Signed-off-by: Benjamin Vouillaume <benjamin.m.vouillaume@gmail.com>
Signed-off-by: Benjamin Vouillaume <benjaminvouillaume@MacBook-Pro-de-Benjamin.local>
Signed-off-by: BenjaminVouillaume <benjaminvouillaume@MacBook-Pro-de-Benjamin.local>
Signed-off-by: BenjaminVouillaume <benjamin.m.vouillaume@gmail.com>
2026-04-29 14:39:20 +03:00
Jérémy Phetphoumy
2ae75661c8
Fix/podman pod check mode support (#1022)
* Fix podman_pod skipping in check mode by adding supports_check_mode=True

The module was not declaring supports_check_mode=True in AnsibleModule(),
causing Ansible to automatically skip the task when running with --check.
The module_utils (podman_pod_lib) already guards execution with
`if not self.module.check_mode`, so the logic was in place — only the
declaration was missing.

Signed-off-by: Jérémy Phetphoumy <j.phetphoumy@gmail.com>

* Add integration tests for podman_pod check mode support

Adds a dedicated integration test target to verify that podman_pod
correctly supports check mode:
- Reports changed on a non-existing pod without creating it
- Is idempotent on an existing pod with the same config
- Reports changed on config diff without modifying the actual pod

Signed-off-by: Jérémy Phetphoumy <j.phetphoumy@gmail.com>

---------

Signed-off-by: Jérémy Phetphoumy <j.phetphoumy@gmail.com>
2026-04-28 22:16:09 +03:00
Terence Honles
abc454ea89
fix podman_secret ignoring 'data' if it's an empty string (#1025)
Signed-off-by: Terence D. Honles <terence@honles.com>
2026-04-28 22:15:16 +03:00
bandit420
0fbcf8f6d5
Feature/1024 podman prune idempotency (#1026)
* fix(podman_prune): mark unchanged when reclaiming 0B
* test(podman_prune): add idempotency test for system prune

* test(podman_prune): add executable parameter to idempotency test

* fix(podman_prune): use broader pattern

---------

Signed-off-by: Eric Badendiek <eric.badendiek@gmx.de>
2026-04-25 15:11:56 +03:00
Sagi Shnaidman
ba2341150e Fix quadlet_options placement when restart_policy is set (#1017)
Plain key=value quadlet_options (e.g. AutoUpdate=registry) were placed
after the [Service] section, making them part of [Service] instead of
[Container]. Split quadlet_options into plain options (appended to the
main section) and section blocks (appended after [Service]).
Fix #1017

Signed-off-by: Sagi Shnaidman <sshnaidm@redhat.com>
2026-04-10 22:35:51 +03:00
Sagi Shnaidman
b13aacc425 podman_network: Add diff and idempotency to ip_ranges in net_config
Fix #1006

Signed-off-by: Sagi Shnaidman <sshnaidm@redhat.com>
2026-03-31 20:51:06 +03:00
Sagi Shnaidman
88999e2bcf Add --platform option to podman_image
Fix #1003
Signed-off-by: Sagi Shnaidman <sshnaidm@redhat.com>
2026-02-27 15:01:56 +02:00
Sagi Shnaidman
09bb5454a9 Add podman Quadlet modules
This commit introduces two new modules for managing Podman Quadlets:

- podman_quadlet: Install and remove Podman Quadlet files
  * Supports installing single files, directories, and additional config files
  * Implements idempotent state management (present/absent)
  * Validates parameters and provides meaningful error messages
  * Default force=true for removal operations
  * Removed deprecated 'ignore' parameter in favor of built-in idempotency

- podman_quadlet_info: Gather information about installed Quadlets
  * Lists all installed quadlets or prints specific quadlet content
  * Supports filtering by quadlet kinds (container, pod, network, etc.)
  * Provides detailed quadlet metadata including status and paths

Key features:
- Shared utilities in module_utils/podman/quadlet.py for code reuse
- Comprehensive integration tests for both modules
- Full idempotency support for all operations
- Proper handling of edge cases (missing files, malformed quadlets, etc.)
- Check mode support for safe dry-run operations
- Extensive documentation and examples

The modules use relative imports for module_utils to support local
development and testing with the containers.podman collection.

Signed-off-by: Sagi Shnaidman <sshnaidm@redhat.com>
2026-02-02 18:10:59 +02:00
Sagi Shnaidman
d6f395d18e Fix tests for new Podman
Fix tests for new Podman
CI: add fuse-overlayfs for buildah tests

Signed-off-by: Sagi Shnaidman <sshnaidm@redhat.com>
2026-01-17 21:38:53 +02:00
Sergey
d43a5a4a48
Fix Ansible warning about test utils (#999)
Fix #993

Signed-off-by: Sagi Shnaidman <sshnaidm@redhat.com>
2026-01-16 15:41:09 +02:00
igor-belousov
5416c5dfd8
fix(podman_prune): set top-level changed status (#997)
* fix(podman_prune): set top-level changed status

The module was returning changed status inside nested dicts,
but Ansible expects it at the top level of the result.

Before: {"image": {"changed": true, ...}} -> Ansible sees changed=false
After:  {"changed": true, "image": {...}} -> Ansible sees changed=true
Signed-off-by: Igor Belousov <igor-belousov@users.noreply.github.com>

* Update plugins/modules/podman_prune.py

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: Igor Belousov <igor-belousov@users.noreply.github.com>

---------

Signed-off-by: Igor Belousov <igor-belousov@users.noreply.github.com>
Co-authored-by: Igor Belousov <igor-belousov@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2026-01-15 13:04:16 +02:00
Calvin Bui
b1a60bf8b7
add passthrough and none log driver options (#988)
Signed-off-by: Calvin Bui <3604363+calvinbui@users.noreply.github.com>
2025-11-04 23:03:44 +02:00
Sergey
21b0097db0
Fix issue with --rm and service in Quadlet (#982)
Fix #913

Signed-off-by: Sagi Shnaidman <sshnaidm@redhat.com>
2025-10-19 19:33:42 +03:00
Sergey
c9dd956776
Fix image idempotency in pull (#983)
Fix #981

Signed-off-by: Sagi Shnaidman <sshnaidm@redhat.com>
2025-10-19 19:18:33 +03:00
Jeoffrey Bakker
0d44070261
Fix idempotency for tagging local images (#980)
Signed-off-by: Jeoffrey Bakker <jeoffreybakker@users.noreply.github.com>
2025-09-18 14:59:31 +03:00
Sergey
991e461ea5
Rewrite podman and buildah connections (#962)
* Rewrite podman and buildah connections

---------

Signed-off-by: Sagi Shnaidman <sshnaidm@redhat.com>
2025-09-11 20:35:09 +03:00
Sergey
15423c0a5a
Fix Ansible sanity issues for new version (#974)
Signed-off-by: Sagi Shnaidman <sshnaidm@redhat.com>
2025-08-29 11:58:20 +03:00
Sergey
f333fe7fca
Add podman system connection modules (#971)
Signed-off-by: Sagi Shnaidman <sshnaidm@redhat.com>
2025-08-25 09:35:27 +03:00
Sergey
ee52d9de78
Add podman image scp option (#970)
* Add podman image scp option

Fix #536


---------

Signed-off-by: Sagi Shnaidman <sshnaidm@redhat.com>
2025-08-19 23:30:35 +03:00
Sergey
9cffa671c8
Fix podman logout for newer Podman (#969)
Fix #935

Signed-off-by: Sagi Shnaidman <sshnaidm@redhat.com>
2025-08-18 23:15:41 +03:00
Sergey
f4b57ac265
Remove quiet mode from pulling image (#968)
Fix #966

Signed-off-by: Sagi Shnaidman <sshnaidm@redhat.com>
2025-08-18 22:51:19 +03:00
Sergey
6ee2f3891b
Add inventory plugins for buildah and podman (#963)
Add inventory plugins for buildah and podman, unit tests and functional CI tests.
---------

Signed-off-by: Sagi Shnaidman <sshnaidm@redhat.com>
2025-08-13 16:48:50 +03:00
Sergey
8f0bc79e6f
Fix podman_image correct delimiter logic for version@digest tags (#960)
Fix incorrect image URL formation when using separate name and tag parameters
where the tag contains a digest. Previously, tags like "8-bookworm@sha256:..."
would incorrectly use "@" as the delimiter between name and tag, resulting in
malformed URLs like "docker.io/valkey/valkey@8-bookworm@sha256:...".
The issue was in ImageRepository.delimiter logic which used substring matching
("sha256" in tag) instead of checking for pure digest format.
Changes:
  - Fix delimiter selection in ImageRepository.__init__() to only use "@" for
    pure digests starting with "sha256:", not any tag containing "sha256"
  - Add comprehensive unit tests covering all delimiter scenarios
  - Add integration tests with real digest validation and edge cases
  - Ensure proper URL formation: name:tag@digest vs name@digest

Before: docker.io/valkey/valkey@8-bookworm@sha256:abc123 (broken)
After:  docker.io/valkey/valkey:8-bookworm@sha256:abc123 (correct)

Fixes #947
Generated with [Claude Code](https://claude.ai/code)

Signed-off-by: Sagi Shnaidman <sshnaidm@redhat.com>
2025-08-05 23:05:17 +03:00
Sergey
e37123e06f
Rewrite podman_image and add tests (#957)
Signed-off-by: Sagi Shnaidman <sshnaidm@redhat.com>
2025-08-04 16:28:35 +03:00
Sergey
f2e813671a
Run black -l 120 on all files, again (#943)
Signed-off-by: Sagi Shnaidman <sshnaidm@redhat.com>
2025-06-26 13:24:44 +03:00
johnsonlien
aa20ede71e
Add podman system info module (#922)
Add podman system info module

Signed-off-by: johnsonlien <johnsonlien95@gmail.com>
Signed-off-by: Sagi Shnaidman <sshnaidm@redhat.com>

Co-authored-by: Sagi Shnaidman <sshnaidm@redhat.com>
2025-06-22 13:13:11 +03:00
lucas-benedito
6ff93e7559
podman_container_lib: Added checks for volume opts (#941)
* podman_container_lib: Added checks for volume opts

Changed the diffparam_volume function to include the volume mount opts.

Signed-off-by: Lucas Benedito <lbenedit@redhat.com>

* Add test for volume mount options

Signed-off-by: Lucas Benedito <lbenedit@redhat.com>

---------

Signed-off-by: Lucas Benedito <lbenedit@redhat.com>
2025-06-22 12:17:32 +03:00
Sergey
4c682e170c
Run black -l 120 on all Python files to unify the style (#939)
Signed-off-by: Sagi Shnaidman <sshnaidm@redhat.com>
2025-06-15 18:25:48 +03:00
Sergey
11cc00e6ca
Fix idempotency for systemd keyword (#937)
Fix #936

Signed-off-by: Sagi Shnaidman <sshnaidm@redhat.com>
2025-05-29 14:16:09 +03:00
André Lersveen
ac5da409fe
Fix idempotency for any podman secret driver (#929)
* Fix idempotency for any podman secret driver

All secret drivers are provided with the same interface in podman, so there is no need to hardcode the state as changed for all drivers other than 'file'.

Signed-off-by: lersveen <7195448+lersveen@users.noreply.github.com>

* ci: add tests for shell secret driver

Signed-off-by: lersveen <7195448+lersveen@users.noreply.github.com>

---------

Signed-off-by: lersveen <7195448+lersveen@users.noreply.github.com>
2025-05-13 15:06:45 +03:00
Sergey
8a57012970
Fix None values in LogOpt in Quadlet (#933)
Fix #914

Signed-off-by: Sagi Shnaidman <sshnaidm@redhat.com>
2025-05-12 12:50:49 +03:00
Sergey
2c040aa346
Set custom tmpfs idempotency (#932)
Fix #918

Signed-off-by: Sagi Shnaidman <sshnaidm@redhat.com>
2025-05-12 12:20:02 +03:00
Sergey
5ea945dffe
Handle image arguments in podman_container (#931)
Signed-off-by: Sagi Shnaidman <sshnaidm@redhat.com>
2025-05-11 18:38:49 +03:00
Evgeni Golov
6946a0bcbd
correctly quote labels and environment variables for quadlets (#920)
Fixes: #807

Signed-off-by: Evgeni Golov <evgeni@golov.de>
2025-04-14 14:47:20 +03:00
Ewoud Kohl van Wijngaarden
40d320d8f6
Document that sdnotify can be set to healthy (#911)
For quadlets you can set sdnotify (which maps to Notify=) to healthy to
use a healthcheck to determine when the container is up.

Signed-off-by: Ewoud Kohl van Wijngaarden <ewoud@kohlvanwijngaarden.nl>
2025-03-10 10:24:42 +02:00
jeu-umanit
1449f4c1b7
doc: podman_secret: fix indentation error in example (#905)
Signed-off-by: Julien Eula <jeula@umanit.fr>
2025-03-03 13:06:30 +02:00
Finn Krein-Schuch
95a7edb26a
Use usedforsecurity for hashlib.sha256 only in python version >=3.9 (#904)
The usedforsecurity keyword argument of the hashlib functions was
introduced in python 3.9. To achieve compatibility with versions below
that, we only use it once it is available.

The usedforsecurity argument forces use of secure hash functions in
specially compiled versions of python. In this case it would force to
upgrade sha256 to a different hash function should sha256 be deemeed
insecure in the future. The podman hash we are comparing against is
(currently) always sha256.

As sha256 is still considered secure, removing this option for older
python versions should be acceptable.
2025-02-17 18:54:36 +02:00
Sergey
47767dab21
Remove docker protocol when inspecting image (#901)
Signed-off-by: Sagi Shnaidman <sshnaidm@redhat.com>
2025-02-17 15:17:47 +02:00
transcaffeine ✨️
14ac4a8045
fix(podman_image): correct intendation on 'loop' keyword (#903)
Signed-off-by: transcaffeine <transcaffeine@finally.coffee>
2025-02-17 15:16:10 +02:00
Popkornium18
a45d94d503
Fix idempotency for containers with env vars containing MAX_SIZE (#893)
Signed-off-by: Popkornium18 <mail@popkornium18.de>
2025-01-19 20:34:26 +02:00
Hagen
16b034b71f
Fix podman_container_copy examples (#882)
Signed-off-by: hagene <hagene@uio.no>
2025-01-08 16:24:49 +02:00
Sergey
64e4247347
Don't pull image when state is absent or pull=never (#889)
fix #888
Signed-off-by: Sagi Shnaidman <sshnaidm@redhat.com>
2025-01-08 15:38:03 +02:00
Sergey
7fa610a416
Convert DNS domain search to a list (#881)
Fix #880

Signed-off-by: Sagi Shnaidman <sshnaidm@redhat.com>
2024-12-13 20:34:17 +02:00
Vinícius Hashimoto
d68ca756de
docs(podman_container): improve comments on network property (#878)
Signed-off-by: vkhashimoto <me@vkhashimoto.dev>
2024-11-24 20:34:29 +02:00
Sergey
a77ca6ab85
Fix list tags failure in podman_search (#875)
Fix #874
Signed-off-by: Sagi Shnaidman <sshnaidm@redhat.com>
2024-11-05 14:35:07 +02:00