xref: /freebsd/release/tools/ec2-cloud-init.conf (revision 6580f5c38dd5b01aeeaed16b370f1a12423437f0)
1#!/bin/sh
2
3. ${WORLDDIR}/release/tools/ec2.conf
4
5# Packages to install into the image we're creating.  In addition to packages
6# present on all EC2 AMIs, we install cloud-init.
7export VM_EXTRA_PACKAGES="${VM_EXTRA_PACKAGES} net/cloud-init"
8
9# Services to enable in rc.conf(5).
10export VM_RC_LIST="${VM_RC_LIST} cloudinit sshd"
11
12vm_extra_pre_umount() {
13	# Configuration common to all EC2 AMIs
14	ec2_common
15
16	# Configure cloud-init
17	cat <<-'EOF' > ${DESTDIR}/usr/local/etc/cloud/cloud.cfg.d/98_ec2.cfg
18		disable_root: true
19		system_info:
20		  distro: freebsd
21		  default_user:
22		    name: ec2-user
23		    lock_passwd: True
24		    groups: [wheel]
25		    shell: /bin/sh
26		    homedir: /home/ec2-user
27		    doas:
28		    - permit nopass ec2-user
29	EOF
30
31	return 0
32}
33