-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbase-image.json
58 lines (56 loc) · 1.69 KB
/
base-image.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
{
"variables": {
"aws_access_key": "{{env `AWS_ACCESS_KEY_ID`}}",
"aws_secret_key": "{{env `AWS_SECRET_ACCESS_KEY`}}",
"aws_region": "{{env `AWS_REGION`}}",
"ami_name": "simple-web-base-{{timestamp}}"
},
"builders": [{
"ami_name": "{{user `ami_name` | clean_ami_name}}",
"type": "amazon-ebs",
"access_key": "{{user `aws_access_key`}}",
"secret_key": "{{user `aws_secret_key`}}",
"region": "{{user `aws_region`}}",
"iam_instance_profile": "PackerRole",
"source_ami_filter": {
"filters": {
"virtualization-type": "hvm",
"name": "ubuntu/images/*ubuntu-bionic-18.04-amd64-server-*",
"root-device-type": "ebs"
},
"owners": ["099720109477"],
"most_recent": true
},
"instance_type": "t3.micro",
"tags": {
"Name": "{{user `ami_name`}}",
"OS_Version": "Ubuntu",
"Release": "Bionic",
"Base_AMI_Name": "{{ .SourceAMIName }}"
},
"snapshot_tags": {
"Name": "{{user `ami_name`}}",
"OS_Version": "Ubuntu",
"Release": "Bionic",
"Base_AMI_Name": "{{ .SourceAMIName }}"
},
"ssh_username": "ubuntu"
}],
"provisioners": [
{
"type": "shell",
"inline": [
"timeout 180 /bin/bash -c 'until stat /var/lib/cloud/instance/boot-finished 2>/dev/null; do echo waiting for cloud-init to finish...; sleep 1; done'",
"sudo apt-get update && sudo apt-get install -y python"
]
},
{
"type": "ansible",
"ansible_env_vars": [
"ANSIBLE_ROLES_PATH=./playbook/galaxy"
],
"playbook_file": "./playbook/base-image.yml",
"extra_arguments": [ "--extra-vars", "aws_region={{user `aws_region`}}" ]
}
]
}