Files
Kamino/roles/nfs_client/molecule/default/prepare.yml
T
Dragonish fcd2290e14
Build / build (pull_request) Successful in 31s
Molecule / molecule (pull_request) Successful in 2m5s
Lint / lint (pull_request) Successful in 2m47s
test(nfs_client): refresh the apt cache in the scenario's prepare
The molecule image ships without apt lists, and --check does not refresh
them, so the fresh-host check found no nfs-common to install and failed
with "No package matching 'nfs-common' is available". The docker, pihole,
system_baseline and traefik scenarios refresh the cache in prepare for the
same reason.

Refs #402

Assisted-by: Claude Code
2026-11-27 21:55:02 +00:00

44 lines
1.4 KiB
YAML

---
# The state a host has before the role runs: a line for /mnt/data that names another server (the
# role must replace it, once) and a line and a mount point for /mnt/old, the entry the converge
# removes. The file in /mnt/old shows that removing the line leaves the directory alone.
- name: Prepare
hosts: all
gather_facts: false
tasks:
# The image ships without apt lists, and --check does not refresh them, so without this the
# fresh-host check finds no nfs-common to install.
- name: Refresh the apt cache
ansible.builtin.apt:
update_cache: true
- name: Seed the fstab lines
ansible.builtin.lineinfile:
path: /etc/fstab
line: "{{ item }}"
create: true
mode: "0644"
loop:
- old-nas.example:/export/data /mnt/data nfs defaults 0 0
- nas.example:/export/old /mnt/old nfs _netdev,nofail 0 0
- name: Create the mount point that the converge leaves alone
ansible.builtin.file:
path: /mnt/old
state: directory
mode: "0750"
- name: Put a file in it
ansible.builtin.copy:
content: kept
dest: /mnt/old/keep
mode: "0644"
# An existing mount point of a present entry: the role must leave its owner and mode alone.
- name: Create a mount point with an owner and a mode of its own
ansible.builtin.file:
path: /mnt/media
state: directory
owner: daemon
mode: "0710"