freebsd-src/release/tools/ec2-cloud-init.conf
Colin Percival 1f4ce7a39f EC2: Add experimental cloud-init images
Known issues:

1. The ec2-user user is created with a homedir of /usr/home/ec2-user
instead of /home/ec2-user; this appears to be a bug in cloud-init's
FreeBSD support.

2. Cloud-init configures IPv4 networking but not IPv6 networking.

releng/14.0 candidate.

Discussed with:	gjb
Reviewed by:	imp
MFC after:	5 days
Relnotes:	yes
Sponsored by:	https://www.patreon.com/cperciva
Differential Revision:	https://reviews.freebsd.org/D41793
2023-09-28 15:18:46 -07:00

32 lines
771 B
Bash

#!/bin/sh
. ${WORLDDIR}/release/tools/ec2.conf
# Packages to install into the image we're creating. In addition to packages
# present on all EC2 AMIs, we install cloud-init.
export VM_EXTRA_PACKAGES="${VM_EXTRA_PACKAGES} net/cloud-init"
# Services to enable in rc.conf(5).
export VM_RC_LIST="${VM_RC_LIST} cloudinit sshd"
vm_extra_pre_umount() {
# Configuration common to all EC2 AMIs
ec2_common
# Configure cloud-init
cat <<-'EOF' > ${DESTDIR}/usr/local/etc/cloud/cloud.cfg.d/98_ec2.cfg
disable_root: true
system_info:
distro: freebsd
default_user:
name: ec2-user
lock_passwd: True
groups: [wheel]
shell: /bin/sh
# Currently broken, cloud-init hard-codes to /usr/home/*
homedir: /home/ec2-user
EOF
return 0
}