---
- name: Ensure efivars is mounted RO
  become: yes
  mount:
    name: /sys/firmware/efi/efivars
    src: efivars
    fstype: efivars
    opts: ro,nosuid,nodev,noexec,noatime
    state: present
  tags:
    - mounts

- name: Ensure NFS share is mounted
  become: yes
  mount:
    name: /shared
    src: spookcentral.{{ network.local_domain }}:/shared
    fstype: nfs4
    opts: rsize=32768,wsize=32768,noauto,noatime,soft,retrans=5,timeo=900,x-systemd.automount,x-systemd.device-timeout=10,x-systemd.idle-timeout=1min
    state: present
  tags:
    - mounts
  when:
    - has_nfs_mount is defined and has_nfs_mount == True

---
# efivars is chattr +i since linux 4.5
- name: Ensure efivars are not mounted ro in fstab
  become: yes
  lineinfile:
    path: /etc/fstab
    state: absent
    regexp: '^efivars'
  tags:
    - mounts

- name: Ensure NFS share is mounted
  become: yes
  mount:
    name: /shared
    src: spookcentral.{{ network.local_domain }}:/shared
    fstype: nfs4
    opts: rsize=32768,wsize=32768,noauto,noatime,soft,retrans=5,timeo=900,x-systemd.automount,x-systemd.device-timeout=10,x-systemd.idle-timeout=1min
    state: present
  tags:
    - mounts
  when:
    - has_nfs_mount is defined and has_nfs_mount == True

Remove efivars mount from fstab
Remove efivars mount from fstab
