/
/
/
1---
2# Doorbell Service - Pull latest image and recreate container
3#
4# Usage via update-services.yml:
5# ansible-playbook update-services.yml --limit doorbell_servers
6
7- name: Update Doorbell
8 tags: [doorbell]
9 block:
10 - name: "Doorbell - Pull latest image and recreate"
11 community.docker.docker_compose_v2:
12 project_src: "{{ doorbell_compose_dir }}"
13 state: present
14 pull: always
15 recreate: auto
16 register: doorbell_update
17
18 - name: "Doorbell - Report update status"
19 debug:
20 msg: "Doorbell: {{ 'updated and recreated' if doorbell_update.changed else 'already up to date' }}"
21
22- name: Prune unused Docker images
23 tags: [cleanup, prune]
24 community.docker.docker_prune:
25 images: true
26 images_filters:
27 dangling: "true"
28 register: prune_result
29
30- name: Report cleanup
31 tags: [cleanup, prune]
32 debug:
33 msg: "Pruned {{ prune_result.images | default([]) | length }} dangling image(s), reclaimed {{ prune_result.images_space_reclaimed | default(0) | human_readable }}"
34 when: prune_result.images | default([]) | length > 0
35