/
/
/
Ansible role that deployes services on my runner machine
1---
2# NFS Remount Sequence - Stop services, remount NFS, restart services
3
4# Stop all services using docker_compose_v2
5- name: Stop Frigate service for NFS remount
6 community.docker.docker_compose_v2:
7 project_src: "{{ frigate_config_dir }}"
8 state: absent
9 when: frigate_enabled
10 ignore_errors: true
11 check_mode: no
12
13- name: Stop Immich service for NFS remount
14 community.docker.docker_compose_v2:
15 project_src: "{{ immich_config_dir }}"
16 state: absent
17 when: immich_enabled
18 ignore_errors: true
19 check_mode: no
20
21- name: Stop Forgejo service for NFS remount
22 community.docker.docker_compose_v2:
23 project_src: "{{ forgejo_config_dir }}"
24 state: absent
25 when: forgejo_enabled
26 ignore_errors: true
27 check_mode: no
28
29- name: Stop Stirling-PDF service for NFS remount
30 community.docker.docker_compose_v2:
31 project_src: "{{ stirling_pdf_config_dir }}"
32 state: absent
33 when: stirling_pdf_enabled
34 ignore_errors: true
35 check_mode: no
36
37- name: Stop Tandoor service for NFS remount
38 community.docker.docker_compose_v2:
39 project_src: "{{ tandoor_config_dir }}"
40 state: absent
41 when: tandoor_enabled
42 ignore_errors: true
43 check_mode: no
44
45- name: Stop Ghost service for NFS remount
46 community.docker.docker_compose_v2:
47 project_src: "{{ ghost_config_dir }}"
48 state: absent
49 when: ghost_enabled
50 ignore_errors: true
51 check_mode: no
52
53- name: Stop Harbor service for NFS remount (external deployment)
54 shell: |
55 cd {{ harbor_config_dir }} && docker compose down || docker-compose down || true
56 when: harbor_enabled
57 ignore_errors: true
58 check_mode: no
59
60# Wait for graceful shutdown
61- name: Wait for services to shut down gracefully
62 pause:
63 seconds: 15
64
65# Unmount and remount NFS shares
66- name: Unmount existing NFS shares
67 shell: |
68 if mountpoint -q "{{ item.local_path }}"; then
69 echo "Unmounting {{ item.local_path }}"
70 umount "{{ item.local_path }}" || umount -f "{{ item.local_path }}" || true
71 fi
72 loop: "{{ runner_nfs_mounts }}"
73 become: true
74 check_mode: no
75
76- name: Remount NFS shares with new options
77 shell: |
78 echo "Mounting {{ item.host }}:{{ item.nfs_path }} to {{ item.local_path }}"
79 mount -t nfs -o {{ item.options }} {{ item.host }}:{{ item.nfs_path }} {{ item.local_path }}
80 loop: "{{ runner_nfs_mounts }}"
81 become: true
82 check_mode: no
83
84# Restart all services using docker_compose_v2
85- name: Restart Frigate service after NFS remount
86 community.docker.docker_compose_v2:
87 project_src: "{{ frigate_config_dir }}"
88 state: present
89 recreate: "always"
90 when: frigate_enabled
91 check_mode: no
92
93- name: Restart Immich service after NFS remount
94 community.docker.docker_compose_v2:
95 project_src: "{{ immich_config_dir }}"
96 state: present
97 recreate: "always"
98 when: immich_enabled
99 check_mode: no
100
101- name: Restart Forgejo service after NFS remount
102 community.docker.docker_compose_v2:
103 project_src: "{{ forgejo_config_dir }}"
104 state: present
105 recreate: "always"
106 when: forgejo_enabled
107 check_mode: no
108
109- name: Restart Stirling-PDF service after NFS remount
110 community.docker.docker_compose_v2:
111 project_src: "{{ stirling_pdf_config_dir }}"
112 state: present
113 recreate: "always"
114 when: stirling_pdf_enabled
115 check_mode: no
116
117- name: Restart Tandoor service after NFS remount
118 community.docker.docker_compose_v2:
119 project_src: "{{ tandoor_config_dir }}"
120 state: present
121 recreate: "always"
122 when: tandoor_enabled
123 check_mode: no
124
125- name: Restart Ghost service after NFS remount
126 community.docker.docker_compose_v2:
127 project_src: "{{ ghost_config_dir }}"
128 state: present
129 recreate: "always"
130 when: ghost_enabled
131 check_mode: no
132
133- name: Restart Harbor service after NFS remount (external deployment)
134 shell: |
135 cd {{ harbor_config_dir }} && docker compose up -d || docker-compose up -d || true
136 when: harbor_enabled
137 ignore_errors: true
138 check_mode: no