---
- name: "Restart whitelist containers"
  block:
    - name: "Remove whitelist containers"
      community.docker.docker_compose_v2:
        project_src: "/home/docker"
        files: "whitelists.yaml"
        project_name: "whitelists"
        remove_orphans: true
        state: absent
      listen: "restart whitelists containers"

    - name: "Start whitelist containers"
      community.docker.docker_compose_v2:
        project_src: "/home/docker"
        files: "whitelists.yaml"
        project_name: "whitelists"
        recreate: always
        remove_orphans: true
        state: present
      listen: "restart whitelist containers"

- name: "Remove intermediate images"
  community.docker.docker_prune:
      builder_cache: true
      images: true
      images_filters:
          label: "stage=builder"
  listen: "remove intermediate images"
  when: inventory_hostname not in groups['full_maintenance']
