containers.podman.podman_prune module – Allows to prune various podman objects¶
Note
This module is part of the containers.podman collection (version 1.15.4).
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_prune
.
New in containers.podman 1.10.0
Synopsis¶
Allows to run
podman container prune
,podman image prune
,podman network prune
,podman volume prune
andpodman system prune
Requirements¶
The below requirements are needed on the host that executes this module.
Podman installed on host
Parameters¶
Parameter |
Comments |
---|---|
Whether to prune containers. Choices:
|
|
A dictionary of filter values used for selecting containers to delete. For example, See the podman documentation for more information on possible filters. |
|
Podman binary. Default: |
|
Whether to prune images. Choices:
|
|
A dictionary of filter values used for selecting images to delete. You can also use See the podman documentation for more information on possible filters. |
|
Whether to prune networks. Choices:
|
|
A dictionary of filter values used for selecting networks to delete. See the podman documentation for more information on possible filters. |
|
Whether to prune unused pods, containers, image, networks and volume data Choices:
|
|
Whether to prune all unused images, not only dangling images. Choices:
|
|
Whether to prune volumes currently unused by any container. Choices:
|
|
Whether to prune volumes. Choices:
|
|
A dictionary of filter values used for selecting volumes to delete. See the podman documentation for more information on possible filters. |
Examples¶
- name: Prune containers older than 24h
containers.podman.podman_prune:
containers: true
containers_filters:
# only consider containers created more than 24 hours ago
until: 24h
- name: Prune everything
containers.podman.podman_prune:
system: true
- name: Prune everything (including non-dangling images)
containers.podman.podman_prune:
system: true
system_all: true
system_volumes: true
Return Values¶
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
List of IDs of deleted containers. Returned: containers is Sample: |
|
List of IDs of deleted images. Returned: images is Sample: |
|
List of IDs of deleted networks. Returned: networks is Sample: |
|
List of ID of deleted containers, volumes, images, network and total reclaimed space Returned: system is Sample: |
|
List of IDs of deleted volumes. Returned: volumes is Sample: |