mirror of
https://github.com/fscotto/infra.git
synced 2026-11-26 13:49:52 +00:00
Fix ai-media automount
This commit is contained in:
@@ -72,9 +72,26 @@
|
|||||||
mode: "0644"
|
mode: "0644"
|
||||||
notify: Reload systemd units
|
notify: Reload systemd units
|
||||||
|
|
||||||
|
- name: Install ai-media bind automount failure restarter
|
||||||
|
ansible.builtin.template:
|
||||||
|
src: ai-media-bind-restarter.service.j2
|
||||||
|
dest: /etc/systemd/system/ai-media-bind-restarter.service
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: "0644"
|
||||||
|
notify: Reload systemd units
|
||||||
|
|
||||||
- name: Flush systemd unit changes
|
- name: Flush systemd unit changes
|
||||||
ansible.builtin.meta: flush_handlers
|
ansible.builtin.meta: flush_handlers
|
||||||
|
|
||||||
|
- name: Stop a stale ai-media bind mount when the Backup source is absent
|
||||||
|
ansible.builtin.systemd_service:
|
||||||
|
name: "{{ desktop_ai_media_bind_mount_unit.stdout }}"
|
||||||
|
state: stopped
|
||||||
|
when:
|
||||||
|
- desktop_ai_media_root in (ansible_facts['mounts'] | default([]) | map(attribute='mount') | list)
|
||||||
|
- desktop_ai_media_external_mountpoint not in (ansible_facts['mounts'] | default([]) | map(attribute='mount') | list)
|
||||||
|
|
||||||
- name: Enable and start ai-media bind automount
|
- name: Enable and start ai-media bind automount
|
||||||
ansible.builtin.systemd_service:
|
ansible.builtin.systemd_service:
|
||||||
name: "{{ desktop_ai_media_bind_automount_unit.stdout }}"
|
name: "{{ desktop_ai_media_bind_automount_unit.stdout }}"
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Recover the ai-media bind automount after an unavailable Backup volume
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
ExecStartPre=/usr/bin/sleep 3
|
||||||
|
ExecStart=/usr/bin/bash -c '/usr/bin/systemctl restart "$(/usr/bin/systemd-escape -p --suffix=automount {{ desktop_ai_media_root }})"'
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
[Unit]
|
[Unit]
|
||||||
Description=On-demand ai-media bind mount from the Backup LUKS volume
|
Description=On-demand ai-media bind mount from the Backup LUKS volume
|
||||||
ConditionPathIsDirectory={{ desktop_ai_media_root }}
|
ConditionPathIsDirectory={{ desktop_ai_media_root }}
|
||||||
|
OnFailure=ai-media-bind-restarter.service
|
||||||
|
|
||||||
[Automount]
|
[Automount]
|
||||||
Where={{ desktop_ai_media_root }}
|
Where={{ desktop_ai_media_root }}
|
||||||
|
|||||||
Reference in New Issue
Block a user