Automates LV expansion, NVMe mount, and Longhorn node disk tagging (hdd/nvme) via Ansible instead of Kustomize-managed manifests.
61 lines
1.4 KiB
YAML
61 lines
1.4 KiB
YAML
---
|
|
- name: Extend root LV to use all free VG space
|
|
community.general.lvol:
|
|
vg: ubuntu-vg
|
|
lv: ubuntu-lv
|
|
size: +100%FREE
|
|
resizefs: true
|
|
register: lv_extend
|
|
failed_when:
|
|
- lv_extend.failed
|
|
- "'matches existing size' not in (lv_extend.msg | default(''))"
|
|
|
|
- name: Create NVMe storage mount point
|
|
ansible.builtin.file:
|
|
path: /mnt/nvme-storage
|
|
state: directory
|
|
owner: root
|
|
group: root
|
|
mode: "0755"
|
|
|
|
- name: Mount NVMe partition
|
|
ansible.posix.mount:
|
|
path: /mnt/nvme-storage
|
|
src: UUID={{ nvme_partition_uuid }}
|
|
fstype: ext4
|
|
opts: defaults,noatime
|
|
state: mounted
|
|
|
|
- name: Create Longhorn data directory on NVMe
|
|
ansible.builtin.file:
|
|
path: /mnt/nvme-storage/longhorn
|
|
state: directory
|
|
owner: root
|
|
group: root
|
|
mode: "0755"
|
|
|
|
- name: Configure Longhorn node disks (HDD + NVMe with tags)
|
|
kubernetes.core.k8s:
|
|
state: patched
|
|
api_version: longhorn.io/v1beta2
|
|
kind: Node
|
|
name: "{{ inventory_hostname }}"
|
|
namespace: longhorn-system
|
|
definition:
|
|
spec:
|
|
disks:
|
|
default-disk-d4d0a27486e915cd:
|
|
allowScheduling: true
|
|
path: /var/lib/longhorn/
|
|
storageReserved: 32212254720
|
|
tags:
|
|
- hdd
|
|
nvme:
|
|
allowScheduling: true
|
|
path: /mnt/nvme-storage/longhorn/
|
|
storageReserved: 10737418240
|
|
tags:
|
|
- nvme
|
|
delegate_to: localhost
|
|
become: false
|