'how do i create an windows hardened image in EC2 image builder using ansible playbooks?

i've been trying to use ec2 image builder to harden a windows image using winrm and ansible playbooks that contain the scripts to my hardening. Since windows does not support running ansible playbooks, i tried to install packer using chocolatey and use a packer provisioner to run my ansible playbooks within the build component of my image builder, but i am not able to proceed further since the "builders" section in the packer.json file is already done by the infrastructure config part by the ec2 image builder. and i cannot ignore the "builders" section and just execute the "provisioners" section ofmthe packer.json file since it is a must to have atleast one "builders" section. not much documentation on the windows ec2 image builder as well. Would help if someone can guide me.

enter image description here

PS C:\Windows\temp\ansible\ami> packer build ami.json Error: Failed to prepare build: "amazon-ebs"

1 error(s) occurred:

  • Error running "ansible-playbook --version": exec: "ansible-playbook": executable file not found in %PATH%


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source