# Role: tmpfs

## Description

Mount certain paths as tmpfs.

Default paths are /root and /tmp.

Deletes the underlying contents of the mounts to avoid leaving "invisible" files that exist beneath the mounts.

https://man7.org/linux/man-pages/man5/tmpfs.5.html

## Usage

Using in a playbook:

```yaml
- name: Play
  gather_facts: true
  gather_subset:
    - distribution
  hosts:
    - all
  roles:
    - samuliy.ansible.tmpfs
  vars:
    ...
```

### Vars

`tmpfs_temporary_remote_tmp_location`:

A temporary tmpdir location, in case /tmp is used and needs to be remounted as tmpfs.

`tmpfs_temporary_root_mount_location`:

A temporary /root location, in case it needs to be remounted as tmpfs.

`tmpfs_mount_opts`:

Mountopts to pass for tmpfs mounts.
These are appended to the 'opts' given in 'tmpfs_mounts'.

`tmpfs_remove_underlying_dir_contents`:

Set to true to remove all files from disk that were previously not on tmpfs, but should have been after the new mounts.

`tmpfs_mounts`:

List of objects for tmpfs mounts.
Objects are required to have fields:
- 'mountpoint'
- 'opts'
- 'mode'
