Example for creating a new windows AMI. Based on this example by hashi corp.
-
Packer version 1.6.6
-
Ansible version 2.9.6
-
The following ansible galaxy collections must be installed:
ansible-galaxy collection install ansible.windows
ansible-galaxy collection install chocolatey.chocolatey
-
-
Your AWS credentials are configured with correct permissions for EC2
Run build command:
packer build windows-server.pkr.hcl
This does the following:
- Find and lanuches a windows AMI
- Bootstrap EC2 with user-data. Our user-data is bootstrap_win.ps1
- Run our Ansible playbook the newly created EC2