diff --git a/ansible/configure-server.yml b/ansible/configure-server.yml index e955800..08d098c 100644 --- a/ansible/configure-server.yml +++ b/ansible/configure-server.yml @@ -21,20 +21,33 @@ - mnt-syno-k8home register: systemd_mount + + - name: Copy automount files + ansible.builtin.copy: + src: files/{{item}}.automount + dest: /etc/systemd/system/{{item}}.automount + owner: root + group: root + mode: 0644 + with_items: + - mnt-syno-InfraBackups + - mnt-syno-k8home + register: systemd_automount + - name: Reload systemd ansible.builtin.systemd: daemon_reload: yes - when: systemd_mount.changed + when: systemd_mount.changed or systemd_automount.changed - - name: Start & Enable systemd mount + - name: Start & Enable systemd automounts ansible.builtin.systemd: - name: "{{item}}.mount" + name: "{{item}}.automount" state: started enabled: yes with_items: - mnt-syno-InfraBackups - mnt-syno-k8home - when: systemd_mount.changed + when: systemd_automount.changed - name: Generate ssh key diff --git a/ansible/files/mnt-syno-InfraBackups.automount b/ansible/files/mnt-syno-InfraBackups.automount new file mode 100644 index 0000000..a15e800 --- /dev/null +++ b/ansible/files/mnt-syno-InfraBackups.automount @@ -0,0 +1,10 @@ +[Unit] +Description=Automount InfraBackups +After=network-online.target +Wants=network-online.target + +[Automount] +Where=/mnt/syno/InfraBackups + +[Install] +WantedBy=remote-fs.target \ No newline at end of file diff --git a/ansible/files/mnt-syno-k8home.automount b/ansible/files/mnt-syno-k8home.automount new file mode 100644 index 0000000..42a58cc --- /dev/null +++ b/ansible/files/mnt-syno-k8home.automount @@ -0,0 +1,10 @@ +[Unit] +Description=Automount k8home +After=network-online.target +Wants=network-online.target + +[Automount] +Where=/mnt/syno/k8home + +[Install] +WantedBy=remote-fs.target \ No newline at end of file