Files
MyMasters/data/ubuntu/user-data
2024-10-20 20:38:22 +02:00

117 lines
6.7 KiB
Plaintext

#cloud-config
autoinstall:
version: 1
early-commands:
- systemctl stop ssh # otherwise packer tries to connect and exceed max attempts
network:
network:
version: 2
ethernets:
ens224:
dhcp4: yes
dhcp-identifier: mac
# To generate hash password
# mkpasswd --method=SHA-512 --rounds=4096
identity:
hostname: VM-UBU-2004
username: firstuser
password: '$6$rounds=4096$XNPkZj6fx696QRSX$5f7X3ht1MX5mBHG7n4xf05j82r8ZfsPaHO5x/XJIWmx9Izbt0fTb7iY2QyXc/dxFiYWvzJ0BeN17JR9m3RsLN1'
locale: en_US.UTF-8
# keyboard:
# layout: fr
# variant: fr
apt:
preserve_sources_list: true
geoip: true
#apt:
# preserve_sources_list: false
# primary:
# - arches: [amd64]
# uri: "http://gahs-repomanager.eua.solvay.com:8081/repository/ubuntu-focal"
# geoip: false
ssh:
install-server: yes
allow-pw: yes
authorized-keys:
- 'ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDMxyXCCF7QuQDIRafwmCNwgLYuegQdJFy3L68itWBKr iwan@T480Buntu'
user-data:
disable_root: false
late-commands:
- echo 'firstuser ALL=(ALL) NOPASSWD:ALL' > /target/etc/sudoers.d/firstuser
- sed -i 's/^#*\(send dhcp-client-identifier\).*$/\1 = hardware;/' /target/etc/dhcp/dhclient.conf
# - 'sed -i "s/dhcp4: true/&\n dhcp-identifier: mac/" /target/etc/netplan/00-installer-config.yaml'
- rm -fv /var/lib/dhcp/*
# - systemctl restart networking
- curtin in-target --target=/target -- apt update
- curtin in-target --target=/target -- apt install -y qemu-guest-agent
# - curtin in-target --target=/target -- apt dist-upgrade -y
# # - sed -ie 's/GRUB_TIMEOUT=.*/GRUB_TIMEOUT=30/' /target/etc/default/grub
storage:
config:
- {grub_device: true, id: disk-sda, name: '', path: /dev/sda, preserve: false, ptable: gpt, type: disk, wipe: superblock}
- {device: disk-sda, flag: bios_grub, id: partition-boot, number: 1, preserve: false, size: 1048576, type: partition}
- {device: disk-sda, flag: '', id: boot-part, number: 2, preserve: false, size: 805306368, type: partition, wipe: superblock}
- {fstype: ext4, id: format-boot, preserve: false, type: format, volume: boot-part, label: BOOT}
- {device: disk-sda, flag: '', id: lvm-part, number: 3, preserve: false, size: -1, type: partition, wipe: superblock}
- {devices: [lvm-part], id: lv_root, name: system-vg, preserve: false, type: lvm_volgroup}
- {device: format-boot, id: mount-boot, path: /boot, type: mount}
# /
- {id: lvm_part_root, name: root-lv, preserve: false, size: 268435456, type: lvm_partition, volgroup: lv_root}
- {fstype: ext4, id: format-root, preserve: false, type: format, volume: lvm_part_root, label: ROOT}
- {device: format-root, id: mount-root, path: /, type: mount}
# /var
- {id: lvm_part_var, name: var-lv, preserve: false, size: 536870912, type: lvm_partition, volgroup: lv_root}
- {fstype: ext4, id: format-var, preserve: false, type: format, volume: lvm_part_var, label: VAR}
- {device: format-var, id: mount-var, path: /var,type: mount}
# /var/log
- {id: lvm_part_varlog, name: varlog-lv, preserve: false, size: 2147483648, type: lvm_partition, volgroup: lv_root}
- {fstype: ext4, id: format-varlog, preserve: false, type: format, volume: lvm_part_varlog, label: VARLOG}
- {device: format-varlog, id: mount-varlog, path: /var/log, type: mount}
# /var/lib
- {id: lvm_part_varlib, name: varlib-lv, preserve: false, size: 2147483648, type: lvm_partition, volgroup: lv_root}
- {fstype: ext4, id: format-varlib, preserve: false, type: format, volume: lvm_part_varlib, label: VARLIB}
- {device: format-varlib, id: mount-varlib, path: /var/lib, type: mount}
# /var/cache
- {id: lvm_part_varcache, name: varcache-lv, preserve: false, size: 2147483648, type: lvm_partition, volgroup: lv_root}
- {fstype: ext4, id: format-varcache, preserve: false, type: format, volume: lvm_part_varcache, label: VARCACHE}
- {device: format-varcache, id: mount-varcache, path: /var/cache, type: mount}
# /home
- {id: lvm_part_home, name: home-lv, preserve: false, size: 2147483648, type: lvm_partition, volgroup: lv_root}
- {fstype: ext4, id: format-home, preserve: false, type: format, volume: lvm_part_home, label: HOME}
- {device: format-home, id: mount-home, path: /home, type: mount}
# /tmp
- {id: lvm_part_tmp, name: tmp-lv, preserve: false, size: 2147483648, type: lvm_partition, volgroup: lv_root}
- {fstype: ext4, id: format-tmp, preserve: false, type: format, volume: lvm_part_tmp, label: TMP}
- {device: format-tmp, id: mount-tmp, path: /tmp, type: mount}
# /usr
- {id: lvm_part_usr, name: usr-lv, preserve: false, size: 5368709120, type: lvm_partition, volgroup: lv_root}
- {fstype: ext4, id: format-usr, preserve: false, type: format, volume: lvm_part_usr, label: USR}
- {device: format-usr, id: mount-usr, path: /usr, type: mount}
# /opt
- {id: lvm_part_opt, name: opt-lv, preserve: false, size: 6442450944, type: lvm_partition, volgroup: lv_root}
- {fstype: ext4, id: format-opt, preserve: false, type: format, volume: lvm_part_opt, label: OPT}
- {device: format-opt, id: mount-opt, path: /opt, type: mount}
# /var/tmp
- {id: lvm_part_vartmp, name: vartmp-lv, preserve: false, size: 2147483648, type: lvm_partition, volgroup: lv_root}
- {fstype: ext4, id: format-vartmp, preserve: false, type: format, volume: lvm_part_vartmp, label: VARTMP}
- {device: format-vartmp, id: mount-vartmp, path: /var/tmp, type: mount}
# swap
- {id: lvm_part_swap, flag: swap, name: swap-lv, preserve: false, size: 4294967296, type: lvm_partition, volgroup: lv_root}
- {fstype: swap, id: format-swap, preserve: false, type: format, volume: lvm_part_swap, label: SWAP}
- {device: format-swap, id: mount-swap, path: '', type: mount}
# /var/crash
- {id: lvm_part_varcrash, name: varcrash-lv, preserve: false, size: 2147483648, type: lvm_partition, volgroup: lv_root}
- {fstype: ext4, id: format-varcrash, preserve: false, type: format, volume: lvm_part_varcrash, label: VARCRASH}
- {device: format-varcrash, id: mount-varcrash, path: /var/crash, type: mount}
# /etc/init.d
- {id: lvm_part_initd, name: initd-lv, preserve: false, size: 10485760, type: lvm_partition, volgroup: lv_root}
- {fstype: ext4, id: format-initd, preserve: false, type: format, volume: lvm_part_initd, label: INITD}
- {device: format-initd, id: mount-initd, path: /etc/init.d, type: mount}