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.
This commit is contained in:
@@ -16,8 +16,11 @@
|
||||
name: "{{ item }}-network"
|
||||
state: restarted
|
||||
listen: Reload systemd
|
||||
loop: |
|
||||
{{ podman_network_output.results | selectattr('changed', 'equalto', true) | map(attribute='item.name') | list }}
|
||||
loop: "{{
|
||||
(podman_networks | map(attribute='name') | list)
|
||||
if (podman_use_quadlet | bool)
|
||||
else (podman_network_output.results | selectattr('changed', 'equalto', true) | map(attribute='item.name') | list)
|
||||
}}"
|
||||
loop_control:
|
||||
label: "{{ item }}"
|
||||
when:
|
||||
@@ -30,8 +33,11 @@
|
||||
name: "{{ item }}-volume"
|
||||
state: restarted
|
||||
listen: Reload systemd
|
||||
loop: |
|
||||
{{ podman_volume_output.results | selectattr('changed', 'equalto', true) | map(attribute='item.name') | list }}
|
||||
loop: "{{
|
||||
(podman_volumes | map(attribute='name') | list)
|
||||
if (podman_use_quadlet | bool)
|
||||
else (podman_volume_output.results | selectattr('changed', 'equalto', true) | map(attribute='item.name') | list)
|
||||
}}"
|
||||
loop_control:
|
||||
label: "{{ item }}"
|
||||
when:
|
||||
@@ -41,20 +47,23 @@
|
||||
|
||||
- name: Restart Podman pods
|
||||
ansible.builtin.systemd:
|
||||
name: |
|
||||
name: >-
|
||||
{{ (podman_systemd_options.pod_prefix if podman_generate_systemd | bool else '')
|
||||
~ item ~ ('-pod' if not podman_generate_systemd | bool else '') }}
|
||||
state: restarted
|
||||
listen: Reload systemd
|
||||
loop: |
|
||||
{{ podman_pod_output.results | selectattr('changed', 'equalto', true) | map(attribute='item.name') | list }}
|
||||
loop: "{{
|
||||
(podman_pods | map(attribute='name') | list)
|
||||
if (podman_use_quadlet | bool)
|
||||
else (podman_pod_output.results | selectattr('changed', 'equalto', true) | map(attribute='item.name') | list)
|
||||
}}"
|
||||
loop_control:
|
||||
label: "{{ item }}"
|
||||
when:
|
||||
- podman_pod_output is defined
|
||||
- podman_pod_output.results | length > 0
|
||||
|
||||
- name: Restart Podman containers
|
||||
- name: Restart changed Podman containers without pod assignment
|
||||
ansible.builtin.systemd:
|
||||
name: >-
|
||||
{{ (podman_systemd_options.container_prefix
|
||||
@@ -62,9 +71,12 @@
|
||||
state: restarted
|
||||
listen: Reload systemd
|
||||
loop: >-
|
||||
{{ podman_container_output.results |
|
||||
{{ (podman_container_output.results |
|
||||
selectattr('changed', 'equalto', true) |
|
||||
map(attribute='item.name') | list }}
|
||||
map(attribute='item.name') | list) |
|
||||
intersect(podman_containers |
|
||||
rejectattr('pod', 'defined') |
|
||||
map(attribute='name') | list) }}
|
||||
loop_control:
|
||||
label: "{{ item }}"
|
||||
when:
|
||||
|
||||
Reference in New Issue
Block a user