Skip to content

Instantly share code, notes, and snippets.

@Bharathkumarraju
Created July 2, 2020 08:39
Show Gist options
  • Save Bharathkumarraju/dc2252cd1aa38f324718891a0136aa76 to your computer and use it in GitHub Desktop.
Save Bharathkumarraju/dc2252cd1aa38f324718891a0136aa76 to your computer and use it in GitHub Desktop.
{
"variables": {
"aws_access_key": "{{env `AWS_ACCESS_KEY`}}",
"aws_secret_key": "{{env `AWS_SECRET_KEY`}}",
"aws_instance_type": "{{env `AWS_INSTANCE_TYPE`}}",
"aws_ami_name": "{{env `AWS_AMI_NAME`}}",
"aws_region": "{{env `AWS_REGION`}}",
"aws_ami_filter_name": "{{env `AWS_AMI_FILTER_NAME`}}",
"aws_base_ami_owner": "{{env `AWS_BASE_AMI_OWNER`}}"
},
"builders": [
{
"type": "amazon-ebs",
"instance_type": "{{user `aws_instance_type`}}",
"ssh_username": "{{user `aws_ssh_user`}}",
"access_key": "{{user `aws_access_key`}}",
"secret_key": "{{user `aws_secret_key`}}",
"ami_name": "{{user `aws_ami_name`}}-{{timestamp}}",
"region": "{{user `aws_region`}}",
"source_ami_filter": {
"filters": {
"virtualization-type": "hvm",
"root-device-type": "ebs",
"name": "{{user `aws_ami_filter_name`}}"
},
"owners": ["{{user `aws_base_ami_owner`}}"],
"most_recent": true
},
"tags": {
"generated_by": "packer",
"generated_on": "{{timestamp}}",
"ami_version": "{{user `aws_ami_name`}}"
},
"run_tags": {
"packer": "builder"
}
}
],
"provisioners": [
{
"type": "ansible",
"playbook_file": "hardening.yml",
"extra_arguments": [
"-vv"
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment