This repository has been archived by the owner on Aug 26, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathaws-cspace.pkr.hcl
114 lines (98 loc) · 2.33 KB
/
aws-cspace.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
packer {
required_plugins {
amazon = {
version = ">= 0.0.2"
source = "github.com/hashicorp/amazon"
}
}
}
variable "ami_prefix" {
type = string
default = "cspace"
}
// TODO: get this from vars
variable "revision" {
type = string
default = "v7.1-branch"
}
variable "root_volume_size_gb" {
type = number
default = 100
}
locals {
timestamp = regex_replace(timestamp(), "[- TZ:]", "")
}
source "amazon-ebs" "ubuntu" {
profile = "collectionspace"
ebs_optimized = true
instance_type = "t3.large"
ssh_username = "ubuntu"
ssh_timeout = "2h"
launch_block_device_mappings {
device_name = "/dev/sda1"
volume_size = "${var.root_volume_size_gb}"
volume_type = "gp3"
delete_on_termination = true
}
source_ami_filter {
filters = {
name = "ubuntu/images/*ubuntu-jammy-22.04-amd64-server-*"
root-device-type = "ebs"
virtualization-type = "hvm"
}
most_recent = true
owners = ["099720109477"]
}
}
build {
name = "collectionspace"
source "amazon-ebs.ubuntu" {
name = "core"
ami_name = "${var.ami_prefix}-core-${var.revision}-${local.timestamp}"
tags = {
tenant = "core"
}
}
source "amazon-ebs.ubuntu" {
name = "lhmc"
ami_name = "${var.ami_prefix}-lhmc-${var.revision}-${local.timestamp}"
tags = {
tenant = "lhmc"
}
}
source "amazon-ebs.ubuntu" {
name = "fcart"
ami_name = "${var.ami_prefix}-fcart-${var.revision}-${local.timestamp}"
tags = {
tenant = "fcart"
}
}
source "amazon-ebs.ubuntu" {
name = "anthro"
ami_name = "${var.ami_prefix}-anthro-${var.revision}-${local.timestamp}"
tags = {
tenant = "anthro"
}
}
source "amazon-ebs.ubuntu" {
name = "materials"
ami_name = "${var.ami_prefix}-materials-${var.revision}-${local.timestamp}"
tags = {
tenant = "materials"
}
}
provisioner "ansible" {
playbook_file = "./security.yml"
extra_arguments = [
"--extra-vars", "@vars/build.yml"
]
}
provisioner "ansible" {
playbook_file = "./collectionspace.yml"
extra_arguments = [
"--extra-vars", "@vars/build.yml",
"--extra-vars", "collectionspace_tenant=${source.name}",
"--extra-vars", "{ certbot_certs: [] }"
]
}
}