diff options
Diffstat (limited to 'alpine-ami.yaml')
-rw-r--r-- | alpine-ami.yaml | 93 |
1 files changed, 34 insertions, 59 deletions
diff --git a/alpine-ami.yaml b/alpine-ami.yaml index af97e49..bc39b89 100644 --- a/alpine-ami.yaml +++ b/alpine-ami.yaml | |||
@@ -1,84 +1,59 @@ | |||
1 | variables: | 1 | variables: |
2 | security_group: "" | ||
3 | subnet: "" | ||
4 | public_ip: "false" | ||
5 | 2 | ||
6 | # Treat this similar to a ABUILD pkgrel variable and increment with every | 3 | # NOTE: Additional configuration is set via the `variables.json` file. |
7 | # release. Packer will notice an exiting AMI at build start and fail unless | 4 | # To use default values, simply `cp variables.json-default variables.json`. |
8 | # it is rmoved. To prevent a period of time where no Alpine AMI exists, | 5 | # See `variables.json-example` for full configuration variable descriptions. |
9 | # create a new variant. Old AMIs should be pruned at some point. | ||
10 | ami_release: "0" | ||
11 | 6 | ||
12 | # Overriding this requires validating that the installation script still | 7 | # NOTE: Changing alpine_release requires modifying `make_ami.sh` -- don't |
13 | # works as expected. It probably does but stuff changes between major | 8 | # override this in `variables.json`! |
14 | # version. | ||
15 | alpine_release: "3.8" | 9 | alpine_release: "3.8" |
16 | 10 | ||
17 | # Don't override this without a good reason and if you do just make sure it | ||
18 | # gets passed all the way through to the make_ami script | ||
19 | volume_name: "/dev/xvdf" | ||
20 | 11 | ||
21 | builders: | 12 | builders: |
22 | - type: "amazon-ebssurrogate" | 13 | - type: "amazon-ebssurrogate" |
23 | 14 | ||
24 | # Image is built inside a custom VPC so let Packer use the existing | 15 | ### Builder Instance Details |
25 | # resources | ||
26 | security_group_id: "{{user `security_group`}}" | ||
27 | subnet_id: "{{user `subnet`}}" | ||
28 | 16 | ||
29 | # Input Instance Setting | 17 | vpc_id: "{{user `vpc`}}" |
30 | instance_type: "t2.nano" | 18 | subnet_id: "{{user `subnet`}}" |
19 | security_group_id: "{{user `security_group`}}" | ||
20 | instance_type: "{{user `build_instance_type`}}" | ||
21 | associate_public_ip_address: "{{user `public_ip`}}" | ||
31 | launch_block_device_mappings: | 22 | launch_block_device_mappings: |
32 | - volume_type: "gp2" | 23 | - volume_type: "gp2" |
33 | device_name: "{{user `volume_name`}}" | 24 | device_name: "{{user `volume_name`}}" |
34 | delete_on_termination: true | 25 | delete_on_termination: "true" |
35 | volume_size: 1 | 26 | volume_size: "{{user `volume_size`}}" |
36 | associate_public_ip_address: "{{user `public_ip`}}" | ||
37 | |||
38 | # Output AMI Settings | ||
39 | ena_support: true | ||
40 | ami_name: "Alpine-{{user `alpine_release`}}-r{{user `ami_release`}}-EC2" | ||
41 | ami_description: "Alpine Linux {{user `alpine_release`}}-r{{user `ami_release`}} Release with EC2 Optimizations" | ||
42 | ami_groups: | ||
43 | - "all" | ||
44 | ami_virtualization_type: "hvm" | ||
45 | ami_regions: | ||
46 | - us-east-1 | ||
47 | - us-east-2 | ||
48 | - us-west-1 | ||
49 | - us-west-2 | ||
50 | - ca-central-1 | ||
51 | - eu-central-1 | ||
52 | - eu-west-1 | ||
53 | - eu-west-2 | ||
54 | - eu-west-3 | ||
55 | - ap-northeast-1 | ||
56 | - ap-northeast-2 | ||
57 | # - ap-northeast-3 | ||
58 | - ap-southeast-1 | ||
59 | - ap-southeast-2 | ||
60 | - ap-south-1 | ||
61 | - sa-east-1 | ||
62 | ami_root_device: | ||
63 | source_device_name: "{{user `volume_name`}}" | ||
64 | device_name: "/dev/xvda" | ||
65 | delete_on_termination: true | ||
66 | volume_size: 1 | ||
67 | volume_type: "gp2" | ||
68 | |||
69 | # Use the most recent Amazon Linux AMI as our base | ||
70 | ssh_username: "ec2-user" | 27 | ssh_username: "ec2-user" |
71 | source_ami_filter: | 28 | source_ami_filter: |
29 | # use the latest Amazon Linux AMI | ||
72 | filters: | 30 | filters: |
73 | virtualization-type: "hvm" | 31 | virtualization-type: "hvm" |
74 | root-device-type: "ebs" | 32 | root-device-type: "ebs" |
75 | architecture: "x86_64" | 33 | architecture: "x86_64" |
76 | name: "amzn-ami-hvm-*-x86_64-gp2" | 34 | name: "amzn-ami-hvm-*-x86_64-gp2" |
77 | owners: | 35 | owners: |
78 | - "137112412989" | 36 | - "137112412989" |
79 | most_recent: true | 37 | most_recent: "true" |
38 | |||
39 | ### Built AMI Details | ||
40 | |||
41 | ami_name: "{{user `ami_name_prefix`}}{{user `alpine_release`}}-r{{user `ami_release`}}{{user `ami_name_suffix`}}" | ||
42 | ami_description: "{{user `ami_desc_prefix`}}{{user `alpine_release`}}-r{{user `ami_release`}}{{user `ami_desc_suffix`}}" | ||
43 | ami_virtualization_type: "hvm" | ||
44 | ami_root_device: | ||
45 | source_device_name: "{{user `volume_name`}}" | ||
46 | device_name: "/dev/xvda" | ||
47 | delete_on_termination: "true" | ||
48 | volume_size: "{{user `volume_size`}}" | ||
49 | volume_type: "gp2" | ||
50 | ena_support: "{{user `ena_enable`}}" | ||
51 | sriov_support: "{{user `sriov_enable`}}" | ||
52 | ami_groups: "{{user `ami_access`}}" | ||
53 | ami_regions: "{{user `deploy_regions`}}" | ||
54 | |||
80 | 55 | ||
81 | provisioners: | 56 | provisioners: |
82 | - type: "shell" | 57 | - type: "shell" |
83 | script: "make_ami.sh" | 58 | script: "make_ami.sh" |
84 | execute_command: "sudo sh -c '{{ .Vars }} {{ .Path }} {{user `volume_name`}}'" | 59 | execute_command: 'sudo sh -c "{{ .Vars }} {{ .Path }} {{user `volume_name`}} {{user `kernel_flavor`}} ''{{user `add_repos`}}'' ''{{user `add_pkgs`}}''"' |