Need help retrying failed builds

We are building custom AMI’s using CodeBuild and packer. I’m trying to find a way to automatically retry a failed build. I noticed there is a max_retries option for packer however I can’t seem to get the syntax correct. I was hoping someone might have an example template somewhere showing it’s proper use.
I’ve gone over the documentation and thought I had it in the right place. I’ll post three different examples of what I’ve tried below.
Hoping someone can point me in the right direction.
Appreciate the help!

“provisioner”: [
{
“type”: “shell-local”,
“command”: “pip install --proxy=http:/ --trusted-host -i https:// hvac; pip install --proxy=http:// --trusted-host -i https:// jmespath”
},
{
“type”: “ansible”,
“user”: “Administrator”,
“inventory_directory”: “./ansible”,
“host_alias”: “image-factory-ec2”,
“extra_arguments”: ["–extra-vars", “ansible_become_user=Administrator” ,
“–extra-vars”, “ansible_password={{.WinRMPassword}} ansible_become_password={{.WinRMPassword}}”,
“–extra-vars”, “datacenter=”,
“–extra-vars”, “ANSIBLE_DEBUG=true”,
“–extra-vars”, “-vvvv”,
“–extra-vars”, “roletype=ami”
],
“playbook_file”: “./ansible/ami-install.yml”,
“max_retries”: 2
}],

“provisioner”: [
{
“type”: “shell-local”,
“command”: “pip install --proxy=http:/ --trusted-host -i https:// hvac; pip install --proxy=http:// --trusted-host -i https:// jmespath”,
“max_retries”: 2
},
{
“type”: “ansible”,
“user”: “Administrator”,
“inventory_directory”: “./ansible”,
“host_alias”: “image-factory-ec2”,
“extra_arguments”: ["–extra-vars", “ansible_become_user=Administrator” ,
“–extra-vars”, “ansible_password={{.WinRMPassword}} ansible_become_password={{.WinRMPassword}}”,
“–extra-vars”, “datacenter=”,
“–extra-vars”, “ANSIBLE_DEBUG=true”,
“–extra-vars”, “-vvvv”,
“–extra-vars”, “roletype=ami”
],
“playbook_file”: “./ansible/ami-install.yml”
}],

“provisioner”: [
{
“type”: “shell-local”,
“command”: “pip install --proxy=http:/ --trusted-host -i https:// hvac; pip install --proxy=http:// --trusted-host -i https:// jmespath”
},
{
“type”: “ansible”,
“user”: “Administrator”,
“inventory_directory”: “./ansible”,
“host_alias”: “image-factory-ec2”,
“max_retries”: 2,
“extra_arguments”: ["–extra-vars", “ansible_become_user=Administrator” ,
“–extra-vars”, “ansible_password={{.WinRMPassword}} ansible_become_password={{.WinRMPassword}}”,
“–extra-vars”, “datacenter=”,
“–extra-vars”, “ANSIBLE_DEBUG=true”,
“–extra-vars”, “-vvvv”,
“–extra-vars”, “roletype=ami”
],
“playbook_file”: “./ansible/ami-install.yml”
}],

I know it might look incomplete. I redacted some things and pasting simply removed them.