/
/
/
Ansible role that deployes services on my runner machine
1---
2# Runner Services - Pull latest images and recreate containers
3#
4# Usage via update-services.yml:
5# All runner services: ansible-playbook update-services.yml --limit runner_servers
6# Single service: ansible-playbook update-services.yml --limit runner_servers --tags frigate
7# Multiple services: ansible-playbook update-services.yml --limit runner_servers --tags "frigate,immich"
8
9- name: Update Frigate
10 when: frigate_enabled
11 tags: [frigate]
12 block:
13 - name: "Frigate - Pull latest images and recreate"
14 community.docker.docker_compose_v2:
15 project_src: "{{ frigate_config_dir }}"
16 state: present
17 pull: always
18 recreate: auto
19 register: frigate_update
20
21 - name: "Frigate - Report update status"
22 debug:
23 msg: "Frigate: {{ 'updated and recreated' if frigate_update.changed else 'already up to date' }}"
24
25- name: Update Immich
26 when: immich_enabled
27 tags: [immich]
28 block:
29 - name: "Immich - Pull latest images and recreate"
30 community.docker.docker_compose_v2:
31 project_src: "{{ immich_config_dir }}"
32 state: present
33 pull: always
34 recreate: auto
35 register: immich_update
36
37 - name: "Immich - Report update status"
38 debug:
39 msg: "Immich: {{ 'updated and recreated' if immich_update.changed else 'already up to date' }}"
40
41- name: Update Forgejo
42 when: forgejo_enabled
43 tags: [forgejo]
44 block:
45 - name: "Forgejo - Pull latest images and recreate"
46 community.docker.docker_compose_v2:
47 project_src: "{{ forgejo_config_dir }}"
48 state: present
49 pull: always
50 recreate: auto
51 register: forgejo_update
52
53 - name: "Forgejo - Report update status"
54 debug:
55 msg: "Forgejo: {{ 'updated and recreated' if forgejo_update.changed else 'already up to date' }}"
56
57- name: Update Stirling-PDF
58 when: stirling_pdf_enabled
59 tags: [stirling-pdf]
60 block:
61 - name: "Stirling-PDF - Pull latest images and recreate"
62 community.docker.docker_compose_v2:
63 project_src: "{{ stirling_pdf_config_dir }}"
64 state: present
65 pull: always
66 recreate: auto
67 register: stirling_update
68
69 - name: "Stirling-PDF - Report update status"
70 debug:
71 msg: "Stirling-PDF: {{ 'updated and recreated' if stirling_update.changed else 'already up to date' }}"
72
73- name: Update Tandoor
74 when: tandoor_enabled
75 tags: [tandoor]
76 block:
77 - name: "Tandoor - Pull latest images and recreate"
78 community.docker.docker_compose_v2:
79 project_src: "{{ tandoor_config_dir }}"
80 state: present
81 pull: always
82 recreate: auto
83 register: tandoor_update
84
85 - name: "Tandoor - Report update status"
86 debug:
87 msg: "Tandoor: {{ 'updated and recreated' if tandoor_update.changed else 'already up to date' }}"
88
89- name: Update Ghost CMS
90 when: ghost_enabled
91 tags: [ghost]
92 block:
93 - name: "Ghost CMS - Pull latest images and recreate"
94 community.docker.docker_compose_v2:
95 project_src: "{{ ghost_config_dir }}"
96 state: present
97 pull: always
98 recreate: auto
99 register: ghost_update
100
101 - name: "Ghost CMS - Report update status"
102 debug:
103 msg: "Ghost CMS: {{ 'updated and recreated' if ghost_update.changed else 'already up to date' }}"
104
105- name: Update CVAT
106 when: cvat_enabled
107 tags: [cvat]
108 block:
109 - name: "CVAT - Pull latest images and recreate"
110 community.docker.docker_compose_v2:
111 project_src: "{{ cvat_config_dir }}"
112 state: present
113 pull: always
114 recreate: auto
115 register: cvat_update
116
117 - name: "CVAT - Report update status"
118 debug:
119 msg: "CVAT: {{ 'updated and recreated' if cvat_update.changed else 'already up to date' }}"
120
121- name: Update Harbor
122 when: harbor_enabled
123 tags: [harbor]
124 block:
125 - name: "Harbor - Pull latest images and recreate"
126 community.docker.docker_compose_v2:
127 project_src: "{{ harbor_config_dir }}"
128 state: present
129 pull: always
130 recreate: auto
131 register: harbor_update
132
133 - name: "Harbor - Report update status"
134 debug:
135 msg: "Harbor: {{ 'updated and recreated' if harbor_update.changed else 'already up to date' }}"
136
137- name: Update LLM Stack
138 when: llm_stack_enabled
139 tags: [llm-stack, ollama, openwebui, litellm]
140 block:
141 - name: "LLM Stack - Pull latest images and recreate"
142 community.docker.docker_compose_v2:
143 project_src: "{{ llm_stack_config_dir }}"
144 state: present
145 pull: always
146 recreate: auto
147 register: llm_update
148
149 - name: "LLM Stack - Report update status"
150 debug:
151 msg: "LLM Stack: {{ 'updated and recreated' if llm_update.changed else 'already up to date' }}"
152
153- name: Prune unused Docker images
154 tags: [cleanup, prune]
155 community.docker.docker_prune:
156 images: true
157 images_filters:
158 dangling: "true"
159 register: prune_result
160
161- name: Report cleanup
162 tags: [cleanup, prune]
163 debug:
164 msg: "Pruned {{ prune_result.images | default([]) | length }} dangling image(s), reclaimed {{ prune_result.images_space_reclaimed | default(0) | human_readable }}"
165 when: prune_result.images | default([]) | length > 0
166