This commit is contained in:
Daniel Akulenok
2026-01-10 23:21:34 +01:00
parent af66520dcb
commit 17fea0e02b
9 changed files with 452 additions and 380 deletions

View File

@@ -11,30 +11,52 @@
ansible.builtin.systemd:
daemon_reload: true
- name: Start Podman pods
- name: Restart Podman pods
ansible.builtin.systemd:
name: "{{ podman_systemd_options.pod_prefix }}{{ item.name }}"
enabled: true
state: started
daemon_reload: true
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_pods }}"
loop: "{{ podman_pod_output.results | selectattr('changed', 'equalto', true) | map(attribute='item.name') | list }}"
loop_control:
label: "{{ item.name }}"
label: "{{ item }}"
when:
- podman_pods is defined
- podman_pods | length > 0
- podman_pod_output is defined
- podman_pod_output.results | length > 0
- name: Start Podman podless containers
- name: Restart Podman containers
ansible.builtin.systemd:
name: "{{ podman_systemd_options.container_prefix }}{{ item.name }}"
enabled: true
state: started
daemon_reload: true
name: "{{ (podman_systemd_options.container_prefix if podman_generate_systemd | bool else '') ~ item }}"
state: restarted
listen: Reload systemd
loop: "{{ podman_containers | rejectattr('pod', 'defined') | list }}"
loop: "{{ podman_container_output.results | selectattr('changed', 'equalto', true) | map(attribute='item.name') | list }}"
loop_control:
label: "{{ item.name }}"
label: "{{ item }}"
when:
- podman_containers is defined
- podman_containers | length > 0
- podman_container_output is defined
- podman_container_output.results | length > 0
- name: Restart Podman networks
ansible.builtin.systemd:
name: "{{ item }}-network"
state: restarted
listen: Reload systemd
loop: "{{ podman_network_output.results | selectattr('changed', 'equalto', true) | map(attribute='item.name') | list }}"
loop_control:
label: "{{ item }}"
when:
- podman_network_output is defined
- podman_network_output.results | length > 0
- not podman_generate_systemd | bool
- name: Restart Podman volumes
ansible.builtin.systemd:
name: "{{ item }}-volume"
state: restarted
listen: Reload systemd
loop: "{{ podman_volume_output.results | selectattr('changed', 'equalto', true) | map(attribute='item.name') | list }}"
loop_control:
label: "{{ item }}"
when:
- podman_volume_output is defined
- podman_volume_output.results | length > 0
- not podman_generate_systemd | bool