mirror of
https://github.com/dredx/prole.git
synced 2026-09-24 15:04:31 +00:00
Update inventory/roles to keep K3s state on local storage and prevent iSCSI from managing /var/lib/rancher. Also add a single-host k3s install playbook, a systemd override template, and docs describing the installer ↔ Ansible boundary and slow-storage knobs. Co-authored-by: Junie <junie@jetbrains.com>
52 lines
1.8 KiB
YAML
52 lines
1.8 KiB
YAML
---
|
|
- name: Unmount stale iSCSI mounts
|
|
ansible.builtin.mount:
|
|
path: "{{ item.path | default(item) }}"
|
|
state: unmounted
|
|
loop: "{{ iscsi_absent_mounts | default([]) }}"
|
|
loop_control:
|
|
label: "{{ item.path | default(item) }}"
|
|
tags:
|
|
- iscsi_cleanup
|
|
|
|
- name: Guardrail - iSCSI must not manage /var/lib/rancher
|
|
ansible.builtin.assert:
|
|
that:
|
|
- >-
|
|
(iscsi_targets | default([])
|
|
| map(attribute='mounts') | list | flatten
|
|
| selectattr('path', 'equalto', '/var/lib/rancher')
|
|
| list | length) == 0
|
|
fail_msg: >-
|
|
Inventory attempts to mount `/var/lib/rancher` via iSCSI. K3s state storage is
|
|
intended to be local host storage (e.g. USB3 SSD on myrddin). Remove
|
|
`/var/lib/rancher` from `iscsi_targets[*].mounts` (or set
|
|
`iscsi_allow_rancher_mount: true` if you are intentionally overriding this).
|
|
when: not (iscsi_allow_rancher_mount | default(false) | bool)
|
|
|
|
- name: Remove stale iSCSI fstab entries
|
|
ansible.builtin.lineinfile:
|
|
path: /etc/fstab
|
|
state: absent
|
|
regexp: "^\\s*\\S+\\s+{{ (item.path | default(item)) | regex_escape }}\\s+"
|
|
loop: "{{ iscsi_absent_mounts | default([]) }}"
|
|
loop_control:
|
|
label: "{{ item.path | default(item) }}"
|
|
tags:
|
|
- iscsi_cleanup
|
|
|
|
- name: Mount filesystems for iSCSI targets
|
|
ansible.builtin.include_tasks: iscsi_mount.yml
|
|
loop: "{{ iscsi_targets | default([]) | map(attribute='mounts') | list | flatten }}"
|
|
loop_control:
|
|
loop_var: m
|
|
|
|
- name: Guardrail - ensure required mountpoints are mounted
|
|
ansible.builtin.command: "findmnt -n {{ item.path }}"
|
|
register: _findmnt
|
|
changed_when: false
|
|
failed_when: _findmnt.rc != 0
|
|
loop: "{{ iscsi_targets | default([]) | map(attribute='mounts') | list | flatten }}"
|
|
loop_control:
|
|
label: "{{ item.path }}"
|