-
Notifications
You must be signed in to change notification settings - Fork 0
/
jenkins-controller.pkr.hcl
58 lines (46 loc) · 1.14 KB
/
jenkins-controller.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
packer {
required_plugins {
amazon = {
source = "github.com/hashicorp/amazon"
version = "~> 1"
}
ansible = {
version = "~> 1"
source = "github.com/hashicorp/ansible"
}
}
}
variable "ami_id" {
type = string
default = "ami-0735c191cf914754d"
}
variable "efs_mount_point" {
type = string
default = ""
}
locals {
app_name = "jenkins-controller"
}
source "amazon-ebs" "jenkins" {
ami_name = "${local.app_name}"
instance_type = "t2.small"
source_ami = "${var.ami_id}"
region = "us-west-2"
availability_zone = "us-west-2a"
ssh_username = "ubuntu"
tags = {
Env = "dev"
Name = "${local.app_name}"
}
}
build {
sources = ["source.amazon-ebs.jenkins"]
provisioner "ansible" {
playbook_file = "ansible/jenkins-controller.yml"
extra_arguments = ["--extra-vars", "ami-id=${var.ami_id} efs_mount_point=${var.efs_mount_point}", "--scp-extra-args", "'-O'", "--ssh-extra-args", "-o IdentitiesOnly=yes -o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedAlgorithms=+ssh-rsa"]
}
post-processor "manifest" {
output = "manifest.json"
strip_path = true
}
}