-
Notifications
You must be signed in to change notification settings - Fork 0
/
packer.json
82 lines (80 loc) · 2.75 KB
/
packer.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
{
"variables": {
"ami_description": "{{env `AMI_DESCRIPTION`}}",
"ami_name": "{{env `AMI_NAME`}}",
"ami_prefix": "{{env `AMI_PREFIX`}}",
"ami_source_id": "{{env `AMI_SOURCE_ID`}}",
"aws_access_key_id": "{{env `AWS_ACCESS_KEY_ID`}}",
"aws_instance_type": "{{env `AWS_INSTANCE_TYPE`}}",
"aws_region": "{{env `AWS_REGION`}}",
"aws_secret_access_key": "{{env `AWS_SECRET_ACCESS_KEY`}}",
"aws_tag_ami_sources": "{{env `AWS_TAG_AMI_SOURCES`}}",
"aws_tag_build_git_info": "{{env `AWS_TAG_BUILD_GIT_INFO`}}",
"aws_tag_build_git_ref": "{{env `AWS_TAG_BUILD_GIT_REF`}}",
"aws_tag_os_info": "{{env `AWS_TAG_OS_INFO`}}",
"build_time": "{{env `BUILD_TIME`}}",
"ssh_keypair_name": "{{env `SSH_KEYPAIR_NAME`}}",
"ssh_private_key_file": "{{env `SSH_PRIVATE_KEY_FILE`}}",
"ssh_username": "{{env `SSH_USERNAME`}}"
},
"builders": [
{
"type": "amazon-ebs",
"access_key": "{{user `aws_access_key_id`}}",
"ami_description": "{{user `ami_description`}}",
"ami_name": "{{user `ami_name`}}",
"force_deregister": "true",
"instance_type": "{{user `aws_instance_type`}}",
"launch_block_device_mappings": [{
"device_name": "/dev/sda1",
"delete_on_termination": true,
"volume_size": "8"
}],
"region": "{{user `aws_region`}}",
"secret_key": "{{user `aws_secret_access_key`}}",
"source_ami": "{{user `ami_source_id`}}",
"ssh_keypair_name": "{{user `ssh_keypair_name`}}",
"ssh_private_key_file": "{{user `ssh_private_key_file`}}",
"ssh_pty" : "true",
"ssh_username": "{{user `ssh_username`}}",
"tags": {
"ami_sources": "{{user `aws_tag_ami_sources`}}",
"build_git_info": "{{user `aws_tag_build_git_info`}}",
"build_git_ref": "{{user `aws_tag_build_git_ref`}}",
"build_time": "{{user `build_time`}}",
"channel": "dev",
"os_info": "{{user `aws_tag_os_info`}}"
}
}
],
"provisioners": [
{
"type": "file",
"source": "uploads",
"destination": "/tmp"
},
{
"type": "file",
"source": "scripts",
"destination": "/tmp"
},
{
"type": "shell",
"script": "scripts/run_scripts.sh",
"execute_command": "chmod +x {{ .Path }}; {{ .Vars }} sudo -E {{ .Path }}"
},
{
"type": "shell",
"inline": [
"# THINGS TO DO LAST OF ALL ...",
"# ... delete uploads dir on remote",
"sudo rm -rf /tmp/{uploads,scripts}",
"# ... make all delivered cloud-init scripts executables",
"sudo chmod a+x /usr/local/bin/cloud-init/[0-9][0-9][0-9][0-9][0-9]-*",
"# ... delete root's authorized_keys for ssh",
"rm -rvf /root/.ssh/authorized_keys"
]
}
],
"post-processors": []
}