-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathopenstack-bioshell.pkr.hcl
More file actions
91 lines (78 loc) · 1.79 KB
/
Copy pathopenstack-bioshell.pkr.hcl
File metadata and controls
91 lines (78 loc) · 1.79 KB
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
packer {
required_plugins {
openstack = {
version = ">= 1.1.2"
source = "github.com/hashicorp/openstack"
}
ansible = {
version = ">= 1.1.1"
source = "github.com/hashicorp/ansible"
}
}
}
variable "flavor" {
type = string
}
variable "source_image" {
type = string
}
variable "networks" {
type = list(string)
default = null
}
variable "availability_zone" {
type = string
default = null
}
variable "volume_size" {
type = number
default = 20
}
variable "platform" {
type = string
}
variable "image_version" {
type = string
default = "1.0.0"
}
source "openstack" "ubuntu" {
image_name = "bioshell-v${var.image_version}"
flavor = var.flavor
ssh_username = "ubuntu"
volume_size = var.volume_size
networks = var.networks != null ? var.networks : null
availability_zone = var.availability_zone != null ? var.availability_zone : null
source_image_filter {
filters {
name = var.source_image
visibility = "public"
}
}
}
build {
sources = ["source.openstack.ubuntu"]
# 1. Install everything
provisioner "ansible" {
playbook_file = "ansible/build-bioshell.yml"
extra_arguments = [
"--extra-vars", "ansible_user=ubuntu platform=${var.platform}"
]
ansible_env_vars = [
"ANSIBLE_HOST_KEY_CHECKING=False",
"ANSIBLE_SCP_IF_SSH=True"
]
use_proxy = false
}
# 2. Validate — runs after install, before image is saved
provisioner "ansible" {
playbook_file = "ansible/test-bioshell.yml"
extra_arguments = [
"--extra-vars", "ansible_user=ubuntu platform=${var.platform}"
]
ansible_env_vars = [
"ANSIBLE_HOST_KEY_CHECKING=False",
"ANSIBLE_SCP_IF_SSH=True"
]
use_proxy = false
}
}