From f63b9311ec817b6ca249cae9e946de3bd5ccc447 Mon Sep 17 00:00:00 2001
From: Sam Al-Sapti <sam@sapti.me>
Date: Mon, 25 Dec 2023 17:42:25 +0100
Subject: [PATCH] Remove unneeded stuff and add seed_random

---
 cloud.cfg | 77 +++++++++++++++++++++++--------------------------------
 1 file changed, 32 insertions(+), 45 deletions(-)

diff --git a/cloud.cfg b/cloud.cfg
index d5118eb..470cd2c 100644
--- a/cloud.cfg
+++ b/cloud.cfg
@@ -1,80 +1,67 @@
 # vim: ft=yaml
 # cloud-config
 
-users:
-   - default
-
 disable_root: true
-mount_default_fields: [~, ~, 'auto', 'defaults,nofail,x-systemd.requires=cloud-init.service,_netdev', '0', '2']
-resize_rootfs_tmp: /dev
 ssh_pwauth: false
 preserve_hostname: false
 ssh_deletekeys: true
 ssh_genkeytypes: ['rsa', 'ecdsa', 'ed25519']
-syslog_fix_perms: ~
-disable_vmware_customization: false
 timezone: Europe/Copenhagen
-package_update: true
-package_upgrade: true
-package_reboot_if_required: true
+
+random_seed:
+  file: /dev/urandom
+  data: XeQ5b5qm9fAs5mkeuphgUfaUPVCa9WCmsbrbLqrijcNjsSL9uFb2S94k4dn3uSQg
+  command: ['sh', '-c', 'dd if=/dev/hwrng of=$RANDOM_SEED_FILE']
+  command_required: true
 
 device_aliases:
-  swap_disk: /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_drive-scsi1
-  data_disk: /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_drive-scsi2
+  data_disk: /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_drive-scsi1
 disk_setup:
-  swap_disk:
-    table_type: gpt
-    layout: true
-    overwrite: false
   data_disk:
     table_type: gpt
     layout: true
     overwrite: false
 fs_setup:
-  - label: swap
-    filesystem: swap
-    device: swap_disk.1
-    overwrite: false
   - label: data
     filesystem: xfs
     device: data_disk.1
     overwrite: false
 mounts:
-  - ['swap_disk.1', 'none', 'swap', 'sw', '0', '0']
   - ['data_disk.1', '/data', 'xfs', 'defaults', '0', '2']
 
 runcmd:
   - touch /etc/cloud/cloud-init.disabled
 
 cloud_init_modules:
- - disk_setup
- - mounts
- - set_hostname
- - update_hostname
- - update_etc_hosts
- - users-groups
- - ssh
+  - seed_random
+  - disk_setup
+  - mounts
+  - set_hostname
+  - update_hostname
+  - update_etc_hosts
+  - users-groups
+  - ssh
 
 cloud_config_modules:
- - ssh-import-id
- - locale
- - set-passwords
- - timezone
- - disable-ec2-metadata
- - runcmd
+  - ssh-import-id
+  - locale
+  - set-passwords
+  - timezone
+  - disable-ec2-metadata
+  - runcmd
 
 cloud_final_modules:
- - package-update-upgrade-install
- - scripts-vendor
- - scripts-per-once
- - scripts-per-boot
- - scripts-per-instance
- - scripts-user
- - ssh-authkey-fingerprints
- - keys-to-console
- - install-hotplug
- - final-message
- - power-state-change
+  - package-update-upgrade-install
+  - scripts-vendor
+  - scripts-per-once
+  - scripts-per-boot
+  - scripts-per-instance
+  - scripts-user
+  - ssh-authkey-fingerprints
+  - keys-to-console
+  - install-hotplug
+  - final-message
+  - power-state-change
 
 system_info:
    distro: rocky