role_podman/tasks/pods.yml

26 lines
671 B
YAML

---
# tasks file for podman
- name: Deploy pods
containers.podman.podman_pod: "{{ pod }}"
become: true
become_user: "{{ podman_user }}"
loop: "{{ podman_pods }}"
loop_control:
label: "{{ item.name }}"
register: deployed_pods
vars:
pod: "{{ podman_pods_defaults | ansible.builtin.combine(item) }}"
- name: Start or restart pods
ansible.builtin.systemd_service:
name: "{{ item.item.name }}-pod.service"
state: "{{ 'restarted' if item.changed else 'started' }}"
daemon_reload: true
scope: user
become: true
become_user: "{{ podman_user }}"
loop: "{{ deployed_pods.results }}"
loop_control:
label: "{{ item.item.name }}"