---
# Mount shares that all systems should have.

- name: General | Account Management | Mounts | Create 1337 Folder
  file: 
    path: /mnt/leet
    state: directory
    mode: '0755'

# Combine these to be blockinfile again
- name: General | Account Management | Mounts | Create 1337 fstab Entry
  lineinfile:
    path: /etc/fstab
    regexp: '^ling@leet'
    line: "ling@leet: /mnt/leet fuse.sshfs defaults,_netdev,allow_other,delay_connect 0 0"
    state: present
    backup: yes
  when: ansible_system == "Linux"

- name: General | Account Management | Mounts | Create 1337 fstab Comment
  lineinfile:
    path: /etc/fstab
    regexp: '^# MANAGED BY ANSIBLE | Leet Share'
    line: '# MANAGED BY ANSIBLE | Leet Share'
    state: present
    insertbefore: '^ling@leet'
  when: ansible_system == "Linux"

- name: General | Account Management | Mounts | Mount All
  shell: mount -a
  args:
    warn: false
  when: ansible_system == "Linux"

# FreeBSD also has root cron job for this @reboot
- name: General | Cron | Root | Create SSHFS Job
  cron:
    user: root
    name: "1337 SSHFS"
    special_time: reboot
    job: "{{ sshfs_leet_cmd }}"
    state: present
    disabled: no
  when: ansible_system == "FreeBSD"