Files
ansible-podman/tasks/pods.yml
Daniel Akulenok b1a627f2ee Enhance Podman configuration and management
- Update pruning options to include filters for containers, images, networks, and volumes.
- Modify handlers to restart Podman resources based on new conditions.
- Expand Molecule tests to verify networks, volumes, pods, and containers.
- Adjust service management tasks for Podman services and auto-update.
- Refactor tasks for better clarity and maintainability.
2026-02-20 14:49:22 +01:00

100 lines
4.2 KiB
YAML

---
# Manage Podman pods
- name: Manage Podman pods
vars:
pod_item: "{{ podman_pod_defaults | default({}) | combine(item) }}"
containers.podman.podman_pod:
name: "{{ pod_item.name }}"
state: "{{ pod_item.state | default('present') }}"
# Pod networking and publishing
publish: "{{ pod_item.ports | default(omit) }}"
network: "{{ pod_item.networks | default(omit) }}"
network_alias: "{{ pod_item.network_alias | default(omit) }}"
ip: "{{ pod_item.ip | default(omit) }}"
ip6: "{{ pod_item.ip6 | default(omit) }}"
mac_address: "{{ pod_item.mac_address | default(omit) }}"
no_hosts: "{{ pod_item.no_hosts | bool | default(omit) }}"
add_host: "{{ pod_item.add_host | default(omit) }}"
dns: "{{ pod_item.dns | default(omit) }}"
dns_opt: "{{ pod_item.dns_opt | default(omit) }}"
dns_search: "{{ pod_item.dns_search | default(omit) }}"
# Pod storage and volumes
volume: "{{ pod_item.volumes | default(omit) }}"
volumes_from: "{{ pod_item.volumes_from | default(omit) }}"
# Infrastructure container
infra: "{{ pod_item.infra | bool | default(omit) }}"
infra_image: "{{ pod_item.infra_image | default(omit) }}"
infra_command: "{{ pod_item.infra_command | default(omit) }}"
infra_name: "{{ pod_item.infra_name | default(omit) }}"
share_parent: "{{ pod_item.share_parent | bool | default(omit) }}"
# Pod configuration
hostname: "{{ pod_item.hostname | default(omit) }}"
share: "{{ pod_item.share | default(omit) }}"
label: "{{ pod_item.labels | default(omit) }}"
label_file: "{{ pod_item.label_file | default(omit) }}"
annotation: "{{ pod_item.annotations | default(omit) }}"
# Namespaces
userns: "{{ pod_item.userns | default(omit) }}"
uidmap: "{{ pod_item.uidmap | default(omit) }}"
gidmap: "{{ pod_item.gidmap | default(omit) }}"
subuidname: "{{ pod_item.subuidname | default(omit) }}"
subgidname: "{{ pod_item.subgidname | default(omit) }}"
pid: "{{ pod_item.pid | default(omit) }}"
uts: "{{ pod_item.uts | default(omit) }}"
# Security options
security_opt: "{{ pod_item.security_opt | default(omit) }}"
# Resource constraints
memory: "{{ pod_item.memory | default(omit) }}"
memory_swap: "{{ pod_item.memory_swap | default(omit) }}"
cpus: "{{ pod_item.cpus | default(omit) }}"
cpu_shares: "{{ pod_item.cpu_shares | default(omit) }}"
cpuset_cpus: "{{ pod_item.cpuset_cpus | default(omit) }}"
cpuset_mems: "{{ pod_item.cpuset_mems | default(omit) }}"
blkio_weight: "{{ pod_item.blkio_weight | default(omit) }}"
blkio_weight_device: "{{ pod_item.blkio_weight_device | default(omit) }}"
# Device access
device: "{{ pod_item.device | default(omit) }}"
device_read_bps: "{{ pod_item.device_read_bps | default(omit) }}"
device_write_bps: "{{ pod_item.device_write_bps | default(omit) }}"
gpus: "{{ pod_item.gpus | default(omit) }}"
# Shared memory and system configuration
shm_size: "{{ pod_item.shm_size | default(omit) }}"
shm_size_systemd: "{{ pod_item.shm_size_systemd | default(omit) }}"
sysctl: "{{ pod_item.sysctl | default(omit) }}"
cgroup_parent: "{{ pod_item.cgroup_parent | default(omit) }}"
# Pod lifecycle management
exit_policy: "{{ pod_item.exit_policy | default(omit) }}"
restart_policy: "{{ pod_item.restart_policy | default(omit) }}"
pod_id_file: "{{ pod_item.pod_id_file | default(omit) }}"
# Systemd and Quadlet generation
generate_systemd: "{{ pod_item.generate_systemd | default(omit) }}"
quadlet_dir: "{{ pod_item.quadlet_dir | default(omit) }}"
quadlet_filename: "{{ pod_item.quadlet_filename | default(omit) }}"
quadlet_file_mode: "{{ pod_item.quadlet_file_mode | default(omit) }}"
quadlet_options: "{{ pod_item.quadlet_options | default(omit) }}"
# Control and debugging options
recreate: "{{ pod_item.recreate | bool | default(omit) }}"
force_restart: "{{ pod_item.force_restart | bool | default(omit) }}"
force_delete: "{{ pod_item.force_delete | bool | default(omit) }}"
executable: "{{ pod_item.executable | default('podman') }}"
debug: "{{ pod_item.debug | bool | default(omit) }}"
loop: "{{ podman_pods }}"
loop_control:
label: "{{ item.name }}"
register: podman_pod_output
notify:
- Reload systemd