opnsense-src/release/tools/ec2-cloud-init.conf
Colin Percival 6a9e7f6a1d EC2: Make amazon-ssm-agent optional
Move it from VM_EXTRA_PACKAGES in ec2.conf to VM_EXTRA_PACKAGES in
ec2-{base,cloud-init}.conf

Sponsored by:	Amazon
Differential Revision:	https://reviews.freebsd.org/D46508

(cherry picked from commit 40ff0753abb9c00b5f1e5df9ea00c9fdded55ac4)
2024-09-10 22:28:59 -07:00

32 lines
789 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 amazon-ssm-agent and cloud-init.
export VM_EXTRA_PACKAGES="${VM_EXTRA_PACKAGES} amazon-ssm-agent 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
homedir: /home/ec2-user
doas:
- permit nopass ec2-user
EOF
return 0
}