diff options
Diffstat (limited to 'packer.conf')
-rw-r--r-- | packer.conf | 108 |
1 files changed, 108 insertions, 0 deletions
diff --git a/packer.conf b/packer.conf new file mode 100644 index 0000000..cfe3086 --- /dev/null +++ b/packer.conf | |||
@@ -0,0 +1,108 @@ | |||
1 | # This Packer config file is in HOCON, and is converted to JSON at build time. | ||
2 | # https://github.com/lightbend/config/blob/master/HOCON.md | ||
3 | # vim: ts=2 et: | ||
4 | |||
5 | builders = [ | ||
6 | { | ||
7 | type = "amazon-ebssurrogate" | ||
8 | |||
9 | ### Builder Instance Details | ||
10 | |||
11 | region = "{{user `build_region`}}" | ||
12 | subnet_id = "{{user `build_subnet`}}" | ||
13 | instance_type = "{{user `build_instance_type`}}" | ||
14 | associate_public_ip_address = "{{user `build_public_ip`}}" | ||
15 | source_ami_filter { | ||
16 | # use the latest Amazon Linux AMI | ||
17 | owners = [ "{{user `build_ami_owner`}}" ] | ||
18 | most_recent = "{{user `build_ami_latest`}}" | ||
19 | filters { | ||
20 | virtualization-type = "hvm" | ||
21 | root-device-type = "ebs" | ||
22 | architecture = "{{user `build_arch`}}" | ||
23 | name = "{{user `build_ami_name`}}" | ||
24 | } | ||
25 | } | ||
26 | launch_block_device_mappings = [ | ||
27 | { | ||
28 | volume_type = "gp2" | ||
29 | device_name = "/dev/xvdf" | ||
30 | delete_on_termination = "true" | ||
31 | volume_size = "{{user `ami_volume_size`}}" | ||
32 | } | ||
33 | ] | ||
34 | shutdown_behavior = "terminate" | ||
35 | ssh_username = "{{user `build_user`}}" | ||
36 | |||
37 | ### AMI Build Details | ||
38 | |||
39 | ami_name = "{{user `ami_name`}}" | ||
40 | ami_description = "{{user `ami_desc`}}" | ||
41 | tags { | ||
42 | Name = "{{user `ami_name`}}" | ||
43 | } | ||
44 | ami_virtualization_type = "hvm" | ||
45 | ami_architecture = "{{user `build_arch`}}" # need packer 1.4.1 | ||
46 | ami_root_device { | ||
47 | volume_type = "gp2" | ||
48 | source_device_name = "/dev/xvdf" | ||
49 | device_name = "/dev/xvda" | ||
50 | delete_on_termination = "true" | ||
51 | volume_size = "{{user `ami_volume_size`}}" | ||
52 | } | ||
53 | encrypt_boot = "{{user `ami_encrypt`}}" | ||
54 | ena_support = "true" | ||
55 | sriov_support = "true" | ||
56 | ami_groups = "{{user `ami_access`}}" | ||
57 | ami_regions = "{{user `ami_regions`}}" | ||
58 | } | ||
59 | ] | ||
60 | |||
61 | |||
62 | provisioners = [ | ||
63 | { | ||
64 | type = "file" | ||
65 | source = "nvme/" | ||
66 | destination = "/tmp" | ||
67 | } | ||
68 | { | ||
69 | type = "shell" | ||
70 | script = "setup-ami" | ||
71 | environment_vars = [ | ||
72 | "VERSION={{user `version`}}" | ||
73 | "RELEASE={{user `release`}}" | ||
74 | "REVISION={{user `revision`}}" | ||
75 | "ARCH={{user `arch`}}" | ||
76 | "APK_TOOLS={{user `apk_tools`}}" | ||
77 | "APK_TOOLS_SHA256={{user `apk_tools_sha256`}}" | ||
78 | "ALPINE_KEYS={{user `alpine_keys`}}" | ||
79 | "ALPINE_KEYS_SHA256={{user `alpine_keys_sha256`}}" | ||
80 | "REPOS={{user `repos`}}" | ||
81 | "PKGS={{user `pkgs`}}" | ||
82 | "SVCS={{user `svcs`}}" | ||
83 | "KERNEL_MODS={{user `kernel_modules`}}" | ||
84 | "KERNEL_OPTS={{user `kernel_options`}}" | ||
85 | ] | ||
86 | use_env_var_file = "true" | ||
87 | execute_command = "sudo sh -c '. {{.EnvVarFile}} && {{.Path}}'" | ||
88 | } | ||
89 | ] | ||
90 | |||
91 | |||
92 | post-processors = [ | ||
93 | { | ||
94 | type = "manifest" | ||
95 | output = "profile/{{user `profile`}}/{{user `profile_build`}}/manifest.json" | ||
96 | custom_data { | ||
97 | ami_name = "{{user `ami_name`}}" | ||
98 | ami_desc = "{{user `ami_desc`}}" | ||
99 | profile = "{{user `profile`}}" | ||
100 | profile_build = "{{user `profile_build`}}" | ||
101 | version = "{{user `version`}}" | ||
102 | release = "{{user `release`}}" | ||
103 | arch = "{{user `arch`}}" | ||
104 | revision = "{{user `revision`}}" | ||
105 | end_of_life = "{{user `end_of_life`}}" | ||
106 | } | ||
107 | } | ||
108 | ] | ||