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
44 lines
1.4 KiB
YAML
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"
|