I’ve been looking into doing some of my first-boot config through
user_data and cloud-init directives instead of an Ansible playbook.
I noticed my new hosts from a Packer AMI ends up with artifacts from the Packer build process in
/var/lib/cloud/. Am I missing a config of Packer that would cleanup these files from a previous boot/build?
Looking at AWS ImageBuilder docs, they appear to have a scripted cleanup in the Best Practices. I honestly assumed this to be core functionality to a Builder process; leave it like you found it.
Is that a mistaken expectation? Is it all left to the user when it comes to Packer Builders?
EDIT: Reading more I realize that OS-level changes is going to be in a Provisioner. Am I missing a pattern in this?