Created
June 5, 2021 20:28
-
-
Save diegoaceneves/d2fca50679d93ff723f2d6ce59ffeb0f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"variables": { | |
"name": null, | |
"region": "us-east-1" | |
}, | |
"builders": [ | |
{ | |
"type": "amazon-ebs", | |
"region": "{{user `region`}}", | |
"source_ami_filter": { | |
"filters": { | |
"virtualization-type": "hvm", | |
"name": "ubuntu/images/*ubuntu-focal-20.04-amd64-server-*", | |
"root-device-type": "ebs" | |
}, | |
"owners": ["099720109477"], | |
"most_recent": true | |
}, | |
"instance_type": "t2.micro", | |
"ssh_username": "ubuntu", | |
"ami_name": "{{user `name`}} {{timestamp}}", | |
"ami_description": "from {{.SourceAMI}}", | |
"tags": { | |
"OS_Version": "Ubuntu", | |
"Release": "Latest", | |
"Base_AMI_Name": "{{ .SourceAMIName }}", | |
"Extra": "{{ .SourceAMITags.TagName }}" | |
} | |
} | |
], | |
"provisioners": [ | |
{ | |
"type": "ansible", | |
"playbook_file": "ansible/main.yml", | |
"ansible_env_vars": [ | |
"ANSIBLE_HOST_KEY_CHECKING=False", | |
"ANSIBLE_REMOTE_TMP=/tmp/ansible", | |
"ANSIBLE_BECOME=true", | |
"ANSIBLE_BECOME_USER=ubuntu", | |
"ANSIBLE_BECOME_METHOD=sudo" | |
] | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment