63 lines
2.0 KiB
YAML
63 lines
2.0 KiB
YAML
---
|
|
# handlers file for podman
|
|
|
|
- name: Restart podman
|
|
ansible.builtin.systemd:
|
|
name: podman
|
|
state: restarted
|
|
listen: restart podman
|
|
|
|
- name: Reload systemd
|
|
ansible.builtin.systemd:
|
|
daemon_reload: true
|
|
|
|
- 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
|
|
|
|
- name: Restart Podman pods
|
|
ansible.builtin.systemd:
|
|
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_control:
|
|
label: "{{ item }}"
|
|
when:
|
|
- podman_pod_output is defined
|
|
- podman_pod_output.results | length > 0
|
|
|
|
- name: Restart Podman containers
|
|
ansible.builtin.systemd:
|
|
name: "{{ (podman_systemd_options.container_prefix if podman_generate_systemd | bool else '') ~ item }}"
|
|
state: restarted
|
|
listen: Reload systemd
|
|
loop: "{{ podman_container_output.results | selectattr('changed', 'equalto', true) | map(attribute='item.name') | list }}"
|
|
loop_control:
|
|
label: "{{ item }}"
|
|
when:
|
|
- podman_container_output is defined
|
|
- podman_container_output.results | length > 0
|