Files
homelab-infrastructure/ansible/playbook.yaml
T
2026-06-23 19:48:06 +01:00

37 lines
1.0 KiB
YAML

---
- name: Initialise empty disk with BTRFS
hosts: all
vars:
target_disk: /dev/disk/by-id/ata-QEMU_HARDDISK_incus_ext
tasks:
- name: Ensure btrfs-progs, parted and blkid is installed
ansible.builtin.package:
name: "{{ item }}"
state: present
loop:
- btrfs-progs
- parted
- blkid
- name: Ensure external disk has single partition on GPT
community.general.parted:
device: "{{ target_disk }}"
name: ext
number: 1
label: gpt
state: present
- name: Ensure BTRFS is formatted on external disk
community.general.filesystem:
dev: "{{ target_disk }}-part1"
fstype: btrfs
- name: Mount external disk to /mnt
ansible.posix.mount:
src: "{{ target_disk }}-part1"
path: /mnt
fstype: btrfs
state: mounted
# - name: Create BTRFS filesystem on external disk
# community.general.filesystem:
# fstype: btrfs
# dev: "{{ target_disk }}"