-
Notifications
You must be signed in to change notification settings - Fork 12
/
OpenStackSampleWorkload.tf
119 lines (99 loc) · 3.2 KB
/
OpenStackSampleWorkload.tf
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
115
116
117
118
119
#
# load up the cloud with some sample VMs and a network
#
data "template_file" "SampleWorkloadCommon" {
template = file("${path.module}/templates/SampleWorkloadCommon.sh")
vars = {
ADMIN_PASS = random_password.os_admin_password.result
}
}
resource "null_resource" "openstack-sample-workload-common" {
depends_on = [
null_resource.controller-nova,
null_resource.controller-neutron,
null_resource.compute-x86-openstack,
null_resource.compute-arm-openstack,
null_resource.controller-register-compute-hosts,
]
connection {
host = equinix_metal_device.controller.access_public_ipv4
private_key = local_file.cluster_private_key_pem.content
}
provisioner "file" {
source = "${path.module}/assets/userdata.txt"
destination = "userdata.txt"
}
provisioner "file" {
content = data.template_file.SampleWorkloadCommon.rendered
destination = "SampleWorkloadCommon.sh"
}
provisioner "remote-exec" {
inline = [
"bash SampleWorkloadCommon.sh > SampleWorkloadCommon.out",
]
}
}
data "template_file" "SampleWorkloadARM" {
template = file("${path.module}/templates/SampleWorkloadARM.sh")
vars = {
ADMIN_PASS = random_password.os_admin_password.result
}
}
resource "null_resource" "openstack-sample-workload-arm" {
depends_on = [
null_resource.openstack-sample-workload-common,
null_resource.openstack-image-CentOS-8-ARM,
null_resource.openstack-image-Fedora-ARM,
null_resource.openstack-image-Cirros-ARM,
null_resource.openstack-image-Trusty-14_04-ARM,
null_resource.openstack-image-Xenial-16_04-ARM,
null_resource.openstack-flavors,
null_resource.enable-br-public,
null_resource.controller-provider-networks,
]
count = var.openstack_compute-arm_count == 0 ? 0 : 1
connection {
host = equinix_metal_device.controller.access_public_ipv4
private_key = local_file.cluster_private_key_pem.content
}
provisioner "file" {
content = data.template_file.SampleWorkloadARM.rendered
destination = "SampleWorkloadARM.sh"
}
provisioner "remote-exec" {
inline = [
"sleep 60; bash SampleWorkloadARM.sh > SampleWorkloadARM.out",
]
}
}
data "template_file" "SampleWorkloadx86" {
template = file("${path.module}/templates/SampleWorkloadx86.sh")
vars = {
ADMIN_PASS = random_password.os_admin_password.result
}
}
resource "null_resource" "openstack-sample-workload-x86" {
depends_on = [
null_resource.openstack-sample-workload-common,
null_resource.openstack-image-Bionic-18_04-x86,
null_resource.openstack-image-Cirros-x86,
null_resource.openstack-image-CentOS-8-x86,
null_resource.openstack-flavors,
null_resource.enable-br-public,
null_resource.controller-provider-networks,
]
count = var.openstack_compute-x86_count == 0 ? 0 : 1
connection {
host = equinix_metal_device.controller.access_public_ipv4
private_key = local_file.cluster_private_key_pem.content
}
provisioner "file" {
content = data.template_file.SampleWorkloadx86.rendered
destination = "SampleWorkloadx86.sh"
}
provisioner "remote-exec" {
inline = [
"sleep 60; bash SampleWorkloadx86.sh > SampleWorkloadx86.out",
]
}
}