Files
ansible-podman/tasks/systemd.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

55 lines
2.8 KiB
YAML

---
# Generate systemd service files for Podman containers and pods
- name: Generate systemd service files for containers
vars:
systemd_opts: "{{ item.systemd if item.systemd is defined
else (item.generate_systemd if item.generate_systemd is defined else {}) }}"
containers.podman.podman_generate_systemd:
name: "{{ item.name }}"
dest: "{{ podman_systemd_dir }}"
new: "{{ podman_systemd_options.new }}"
force: "{{ podman_systemd_options.force }}"
restart_policy: "{{ systemd_opts.restart_policy | default(podman_systemd_options.restart_policy) }}"
stop_timeout: "{{ systemd_opts.stop_timeout | default(podman_systemd_options.stop_timeout) }}"
no_header: "{{ systemd_opts.no_header | default(podman_systemd_options.no_header) }}"
separator: "{{ systemd_opts.separator | default(podman_systemd_options.separator) }}"
wants: "{{ systemd_opts.wants | default(podman_systemd_options.wants) }}"
after: "{{ systemd_opts.after | default(podman_systemd_options.after) }}"
requires: "{{ systemd_opts.requires | default(podman_systemd_options.requires) }}"
container_prefix: "{{ systemd_opts.container_prefix | default(podman_systemd_options.container_prefix) }}"
pod_prefix: "{{ systemd_opts.pod_prefix | default(podman_systemd_options.pod_prefix) }}"
loop: "{{ podman_containers }}"
loop_control:
label: "{{ item.name }}"
when:
- podman_containers is defined
- podman_containers | length > 0
notify: Reload systemd
- name: Generate systemd service files for pods
vars:
systemd_opts: "{{ item.systemd if item.systemd is defined
else (item.generate_systemd if item.generate_systemd is defined else {}) }}"
containers.podman.podman_generate_systemd:
name: "{{ item.name }}"
dest: "{{ podman_systemd_dir }}"
new: "{{ podman_systemd_options.new }}"
force: "{{ podman_systemd_options.force }}"
restart_policy: "{{ systemd_opts.restart_policy | default(podman_systemd_options.restart_policy) }}"
stop_timeout: "{{ systemd_opts.stop_timeout | default(podman_systemd_options.stop_timeout) }}"
no_header: "{{ systemd_opts.no_header | default(podman_systemd_options.no_header) }}"
separator: "{{ systemd_opts.separator | default(podman_systemd_options.separator) }}"
wants: "{{ systemd_opts.wants | default(podman_systemd_options.wants) }}"
after: "{{ systemd_opts.after | default(podman_systemd_options.after) }}"
requires: "{{ systemd_opts.requires | default(podman_systemd_options.requires) }}"
container_prefix: "{{ systemd_opts.container_prefix | default(podman_systemd_options.container_prefix) }}"
pod_prefix: "{{ systemd_opts.pod_prefix | default(podman_systemd_options.pod_prefix) }}"
loop: "{{ podman_pods }}"
loop_control:
label: "{{ item.name }}"
when:
- podman_pods is defined
- podman_pods | length > 0
notify: Reload systemd