Test SSHFS so that bad FSTAB entries don't get created on Linux when they'll break.
This commit is contained in:
		| @@ -16,5 +16,5 @@ | |||||||
|     cups_pattern: cupsd |     cups_pattern: cupsd | ||||||
|     cups_browse: cups-browsed |     cups_browse: cups-browsed | ||||||
|     cups_browse_pattern: cups-browsed |     cups_browse_pattern: cups-browsed | ||||||
|     sshfs_leet_cmd: "sshfs {{ leet_ssh }}: /mnt/leet -o allow_other,_netdev" |     sshfs_leet_cmd: "sshfs {{ leet_ssh }}: /mnt/leet -o defaults,allow_other,_netdev" | ||||||
|   when: ansible_system == "FreeBSD" |   when: ansible_system == "FreeBSD" | ||||||
| @@ -1,11 +1,16 @@ | |||||||
| --- | --- | ||||||
| # Mount shares that all systems should have. | # Mount shares that all systems should have. | ||||||
|  |  | ||||||
|  | - name: General | Account Management | Mounts | Test SSHFS | ||||||
|  |   shell: "sshfs ling@leet: /mnt/leet -o allow_other,nonempty" | ||||||
|  |   register: sshfs_works | ||||||
|  |  | ||||||
| - name: General | Account Management | Mounts | Create 1337 Folder | - name: General | Account Management | Mounts | Create 1337 Folder | ||||||
|   file:  |   file:  | ||||||
|     path: "{{ leet_drive }}" |     path: "{{ leet_drive }}" | ||||||
|     state: directory |     state: directory | ||||||
|     mode: '0755' |     mode: '0755' | ||||||
|  |   when: sshfs_works | ||||||
|  |  | ||||||
|  |  | ||||||
| #TODO Remove this | #TODO Remove this | ||||||
| @@ -28,7 +33,7 @@ | |||||||
|     backup: yes |     backup: yes | ||||||
|   when: ansible_system == "Linux" |   when: ansible_system == "Linux" | ||||||
|    |    | ||||||
| # Linux uses fstab | #TODO Remove this | ||||||
| - name: General | Account Management | Mounts | Create 1337 fstab Entry | - name: General | Account Management | Mounts | Create 1337 fstab Entry | ||||||
|   blockinfile: |   blockinfile: | ||||||
|     path: /etc/fstab |     path: /etc/fstab | ||||||
| @@ -39,11 +44,23 @@ | |||||||
|     backup: yes |     backup: yes | ||||||
|   when: ansible_system == "Linux" |   when: ansible_system == "Linux" | ||||||
|  |  | ||||||
|  |    | ||||||
|  | # Linux uses fstab | ||||||
|  | - name: General | Account Management | Mounts | Create 1337 fstab Entry | ||||||
|  |   blockinfile: | ||||||
|  |     path: /etc/fstab | ||||||
|  |     block: | | ||||||
|  |       {{ leet_ssh }}: /mnt/leet fuse.sshfs defaults,_netdev,allow_other 0 0 | ||||||
|  |     marker: '# {mark} MANAGED BY ANSIBLE | 1337 Share' | ||||||
|  |     state: present | ||||||
|  |     backup: yes | ||||||
|  |   when: ansible_system == "Linux" and sshfs_works | ||||||
|  |  | ||||||
| - name: General | Account Management | Mounts | Mount All (Linux) | - name: General | Account Management | Mounts | Mount All (Linux) | ||||||
|   shell: mount -a |   shell: mount -a | ||||||
|   args: |   args: | ||||||
|     warn: false |     warn: false | ||||||
|   when: ansible_system == "Linux" |   when: ansible_system == "Linux" and sshfs_works | ||||||
|  |  | ||||||
|  |  | ||||||
| # FreeBSD has to do this via root cron job, fstab is unhappy | # FreeBSD has to do this via root cron job, fstab is unhappy | ||||||
| @@ -51,9 +68,9 @@ | |||||||
|   shell: umount -f /mnt/leet |   shell: umount -f /mnt/leet | ||||||
|   args: |   args: | ||||||
|     warn: false |     warn: false | ||||||
|   when: ansible_system == "FreeBSD" |   when: ansible_system == "FreeBSD" and sshfs_works | ||||||
|   ignore_errors: yes |   ignore_errors: yes | ||||||
|  |  | ||||||
| - name: General | Account Management | Mounts | Remount 1337 (FreeBSD) | - name: General | Account Management | Mounts | Remount 1337 (FreeBSD) | ||||||
|   shell: "{{ sshfs_leet_cmd }}" |   shell: "{{ sshfs_leet_cmd }}" | ||||||
|   when: ansible_system == "FreeBSD" |   when: ansible_system == "FreeBSD" and sshfs_works | ||||||
		Reference in New Issue
	
	Block a user