--- - name: Install SSHFS apt: pkg=sshfs state=latest update_cache=true become: yes - name: Unmount (fusermount) Media Directory command: fusermount -u {{ remote_media_directory }} become: yes ignore_errors: yes - name: Unmount (umount) Media Directory command: umount -l {{ remote_media_directory }} become: yes ignore_errors: yes - name: Remove Media Directory command: rmdir {{ remote_media_directory }} become: yes ignore_errors: yes - name: Copy SSHFS Configuration template: src={{ item.src }} dest={{ item.dest }} owner={{ item.owner }} group={{ item.group }} mode={{ item.mode }} with_items: - {src: fuse.conf, dest: "/etc/fuse.conf", owner: "{{ ssh_username }}", group: "{{ ssh_username }}", mode: "0777"} - {src: ssh_config, dest: "/etc/ssh/ssh_config", owner: "{{ ssh_username }}", group: "{{ ssh_username }}", mode: "0777"} - {src: sshfs_script.j2, dest: "/etc/sshfs_script", owner: "{{ ssh_username }}", group: "{{ ssh_username }}", mode: "0777"} become: yes - name: Add User to Fuse Group command: gpasswd -a $USER fuse become: yes - name: Create Media Directory command: mkdir {{ remote_media_directory }} become: yes - name: Mount Media Directory shell: /etc/sshfs_script args: executable: /bin/bash become: yes