Skip to content

Commit

Permalink
update to disk_setup, fs_setup, and mounts in cloud-init
Browse files Browse the repository at this point in the history
  • Loading branch information
Liran Jdanov committed Dec 17, 2024
1 parent 30b119f commit 39e7d3c
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions modules/cloud-init/nfs-cloud-init.tftpl
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,25 @@ users:
ssh-authorized-keys:
- ${ssh_public_key}

disk_setup:
/dev/disk/by-id/virtio-${nfs_disk_id}:
table_type: gpt
layout: true

fs_setup:
- device: /dev/disk/by-id/virtio-${nfs_disk_id}-part1
filesystem: ext4

mounts:
- ["/dev/disk/by-id/virtio-${nfs_disk_id}-part1", "${nfs_path}", "ext4", "rw", "0", "0"]

runcmd:
# install nfs server package
- apt-get update
- apt-get install -y nfs-kernel-server

# Prepare partition on secondary disk
# Prepare pnfs mountpoint
- mkdir -p ${nfs_path}
- parted -s /dev/disk/by-id/virtio-${nfs_disk_id} mklabel gpt
- parted -s /dev/disk/by-id/virtio-${nfs_disk_id} mkpart primary ext4 0% 100%
- mkfs.ext4 /dev/disk/by-id/virtio-${nfs_disk_id}-part1
- sync

# Mount the partition
- mount -o rw /dev/disk/by-id/virtio-${nfs_disk_id}-part1 ${nfs_path}
- echo "/dev/disk/by-id/virtio-${nfs_disk_id}-part1 ${nfs_path} ext4 rw,relatime" >> /etc/fstab

# Configure permissions
Expand Down

0 comments on commit 39e7d3c

Please sign in to comment.