This repository has been archived by the owner on Mar 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathami.pkr.hcl
63 lines (54 loc) · 1.67 KB
/
ami.pkr.hcl
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
packer {
required_plugins {
amazon = {
version = ">= 0.0.2"
source = "github.com/hashicorp/amazon"
}
}
}
variable "build_number" {}
variable "commit_sha" {}
#variable "aws-access-key-id" {}
#variable "aws-secret-access-key" {}
source "amazon-ebs" "linux" {
# AMI Settings
ami_name = "snipeitdev_goldenAMI_${var.build_number}"
instance_type = "c5.large"
source_ami = "ami-00978328f54e31526"
ssh_username = "ubuntu"
associate_public_ip_address = false
ami_virtualization_type = "hvm"
#role_arn = "arn:aws:iam::416991812294:role/s3jenkins"
#access_key = "${var.aws-access-key-id}"
#region = "us-east-1"
#secret_key = "${var.aws-secret-access-key}"
#role_arn = "arn:aws:iam::416991812294:role/s3jenkins"
#session_name = "SESSION_NAME"
#external_id = "EXTERNAL_ID"
#}
tags = {
type = "base_image"
commit_id = "${var.commit_sha}"
build_number = "${var.build_number}"
server = "api"
}
launch_block_device_mappings {
device_name = "/dev/sda1"
volume_size = 8
volume_type = "gp2"
delete_on_termination = true
encrypted = false
}
# Profile Settings
region = "us-east-2"
ami_regions = ["us-east-1"]
}
build {
sources = [
"source.amazon-ebs.linux"
]
provisioner "ansible" {
playbook_file = "Ansible/main.yml"
user = "ubuntu"
}
}