containers.podman.podman_prune 模块 – 允许清理各种 podman 对象
注意
此模块是 containers.podman 集合(版本 1.16.2)的一部分。
如果您正在使用 ansible 包,您可能已经安装了此集合。它不包含在 ansible-core 中。要检查是否已安装,请运行 ansible-galaxy collection list。
要安装它,请使用:ansible-galaxy collection install containers.podman。您需要其他要求才能使用此模块,请参阅 要求 了解详细信息。
要在 playbook 中使用它,请指定:containers.podman.podman_prune。
containers.podman 1.10.0 中的新增功能
概要
- 允许运行 - podman container prune、- podman image prune、- podman network prune、- podman volume prune和- podman system prune
要求
在执行此模块的主机上需要以下要求。
- 主机上安装了 Podman 
参数
| 参数 | 注释 | 
|---|---|
| 是否清理容器。 选项 
 | |
| Podman 二进制文件。 默认值:  | |
| 布尔值 选项 
 | |
| image_filters 用于选择要删除的镜像的过滤器值字典。 您还可以使用  | |
| network 选项 
 | |
| 是否清理网络。 network_filters | |
| 布尔值 选项 
 | |
| system_all 选项 
 | |
| 是否清理所有未使用的镜像,而不仅仅是悬空镜像。 选项 
 | |
| 布尔值 是否清理当前未被任何容器使用的卷。 | 
volume
- 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
布尔值
是否清理卷。
| volume_filters | 描述 | 
|---|---|
