-
Notifications
You must be signed in to change notification settings - Fork 4
Description
I tried following the README instructions for building things locally, using an AMI keypair with the proper access.
Things don't work out of the box.
Some example steps I took beyond the readme to get further in the build process:
- Installing the packer plugins used in the CI scripts:
packer plugins install "github.com/hashicorp/amazon"
packer plugins install "github.com/hashicorp/ansible"
- Explicitly setting the provisioner user that runs
setup.yml:
"provisioners": [
...,
{
...
"playbook_file": "../provisioners/setup.yml",
"type": "ansible",
"user": "admin"
},
- Explicitly setting the
become_usertorootfor theadd_usersstep ofsetup.yml:
- name: Add Users
hosts: default
become: true
become_user: root
- Changing to
lineinfileinstead ofcopyfor addlowing sudo without password for sudo group:
- name: Allow sudo without password for sudo group
lineinfile:
path: /etc/sudoers.d/sudo_nopasswd
create: yes
line: "%sudo ALL=(ALL:ALL) NOPASSWD:ALL"
mode: '0440'
At this point I got another error:
amazon-ebs: TASK [willshersystems.sshd : Re-raise the error] *******************************
amazon-ebs: task path: /Users/slifty/.ansible/roles/willshersystems.sshd/tasks/install.yml:133
amazon-ebs: fatal: [default]: FAILED! => {"changed": false, "msg": {"failed": true, "msg": "failed to transfer file to /Users/slifty/.ansible/tmp/ansible-local-20988b2ymf0u8/tmpc5p22odf/sshd_config.j2 /home/admin/.ansible/tmp/ansible-tmp-1745874316.012822-21040-96878840327480/source:\n\n"}}
amazon-ebs:
amazon-ebs: TASK [willshersystems.sshd : Remove temporary host keys] ***********************
amazon-ebs: task path: /Users/slifty/.ansible/roles/willshersystems.sshd/tasks/install.yml:137
amazon-ebs: skipping: [default] => {"changed": false, "false_condition": "sshd_test_hostkey.path is defined", "skip_reason": "Conditional result was False"}
and decided... I'm starting to diverge too far from CI, and I don't know if I'm doing so in a way that would actually break CI, so I created this issue instead.
I think it is important for us to be able to build these images locally to test out our build state, rather than having to push to github and trigger a CI build on a branch. That said, this is a large enough task to represent its own prioritization, and possibly some refactoring of this repository to have packer run inside of a container to ensure consistency.
In case it helps, I'm using MacOS 15.4 on an M1 chip. I would be curious if others have a smoother experience.