---

- name: Restart docker daemon
  ansible.builtin.systemd_service:
    state: restarted
    name: docker

- name: Restart inverseproxy container
  block:
    - name: Remove container
      community.docker.docker_compose_v2:
        project_src: /home/docker/inverseproxy
        remove_orphans: true
        state: absent
      async: 120
      poll: 10
      listen: "restart inverseproxy container"

    - name: Start container
      community.docker.docker_compose_v2:
        project_src: /home/docker/inverseproxy
        recreate: always
        remove_orphans: true
        state: present
      async: 120
      poll: 10
      listen: "restart inverseproxy container"
  when: not ansible_check_mode
