/
/
/
Ansible role that deployss my nas configuration. It mostly handles nfs configurations and exports that are tailored to the hardware and service configuration.
1# NAS
2
3NFS server, optional RAID, network bonding, and storage performance tuning.
4
5## Key Parameters
6
7| Variable | Default | Description |
8|----------|---------|-------------|
9| `nas_nfs_enabled` | `true` | Install and configure NFS server |
10| `nas_nfs_exports` | `[]` | NFS export definitions (path, network, options) |
11| `nas_raid_enabled` | `false` | Configure mdadm RAID array |
12| `nas_raid_level` | `5` | RAID level (0/1/5/6/10) |
13| `nas_raid_devices` | `[]` | Block devices for the array |
14| `nas_bonding_enabled` | `false` | Configure network interface bonding |
15| `nas_performance_tuning_enabled` | `true` | Apply network/filesystem performance tweaks |
16| `nas_runner_*_path` | various | Storage paths exported for runner services |
17| `nas_docker_mount_ordering_enabled` | `true` | Order `docker.service` after the storage mount |
18| `nas_docker_mount_ordering_dropin` | `wait-for-storage-mount.conf` | Drop-in filename under `docker.service.d` |
19
20## Workflow
21
221. Install NFS packages (nfs-kernel-server, rpcbind)
232. Configure network bonding via netplan (if enabled)
243. Create storage directories with proper permissions
254. Order Docker after the array mount (see below)
265. Write `/etc/exports` and reload NFS
276. Apply performance tuning (TCP buffers, NFS threads, readahead)
28
29## Docker boot ordering
30
31`nas_storage_base` is mounted with `nofail`, and `docker.service` ships with no
32ordering dependency on it. After an unclean shutdown, mdadm assembly is slow
33enough that Docker can start containers *before* the array is mounted. Any
34container bind-mounting that path then binds the empty pre-mount directory on
35the root filesystem instead of the array â silently. Containers keep running,
36but read and report the root LV rather than the array, so monitoring shows the
37wrong capacity and writes land on the wrong filesystem.
38
39`docker-mount-ordering.yml` installs a drop-in with `RequiresMountsFor=` so
40systemd orders Docker after the generated mount unit. It is skipped on hosts
41without Docker, and warns during a run if the storage base is currently backed
42by something other than an `/dev/md*` device â the signature of this race.
43
44To recover a host that already booted in the bad state:
45
46```bash
47mount /mnt/rstorage
48docker restart $(docker ps -q) # re-resolves stale bind mounts
49```
50