From b669a8c2c92324ee6984fd4ddaef1ccb7cb3cc9b Mon Sep 17 00:00:00 2001 From: Menno van Leeuwen Date: Tue, 11 Mar 2025 22:07:01 +0100 Subject: [PATCH] feat: update SSHFS task to use 'mount -a' and improve failure handling --- config/ansible/tasks/servers/sshfs.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/config/ansible/tasks/servers/sshfs.yml b/config/ansible/tasks/servers/sshfs.yml index 1e81b84..e186bd5 100644 --- a/config/ansible/tasks/servers/sshfs.yml +++ b/config/ansible/tasks/servers/sshfs.yml @@ -39,12 +39,14 @@ state: present regexp: "^sshfs#.*{{ remote_path }}" backup: true + register: fstab_update + notify: Systemctl daemon-reload - - name: Mount SSHFS filesystem + - name: Mount filesystems become: true ansible.builtin.command: - cmd: "sshfs {{ sshfs_user }}@{{ sshfs_host }}:/ {{ remote_path }} -o port={{ sshfs_port }},password_stdin,_netdev,reconnect,ServerAliveInterval=15,ServerAliveCountMax=3" - stdin: "{{ sshfs_pass }}" + cmd: "mount -a" register: mount_result changed_when: mount_result.rc == 0 - failed_when: mount_result.rc != 0 and "already mounted" not in mount_result.stderr + failed_when: mount_result.rc != 0 + when: fstab_update.changed