-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathFortuneCookieServer.tf
99 lines (82 loc) · 2.79 KB
/
FortuneCookieServer.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
resource "metal_device" "fcs" {
depends_on = [metal_ssh_key.host_key]
project_id = var.metal_project_id
metro = var.metro
plan = var.plan
operating_system = var.operating_system
hostname = format("fcs%02d", count.index)
count = var.fcs_count
billing_cycle = "hourly"
connection {
user = "root"
host = self.access_public_ipv4
private_key = file(var.private_key_filename)
}
provisioner "remote-exec" {
inline = [
"ssh-keygen -A",
"apt-get update -y >> apt.out",
"DEBIAN_FRONTEND=noninteractive apt-get install tcpflow dnsutils zip asciinema encfs -y >> apt.out",
"mkdir -p /etc/consul.d",
"mkdir -p /etc/vault.d",
"mkdir -p /usr/share/games/fortunes-raw",
"mkdir -p /usr/share/games/fortunes",
"echo topsecret | encfs -S /usr/share/games/fortunes-raw /usr/share/games/fortunes",
"DEBIAN_FRONTEND=noninteractive apt-get install fortune -y >> apt.out",
]
}
provisioner "file" {
source = "${path.module}/assets/consul-client-config.json"
destination = "/etc/consul.d/consul-client-config.json"
}
provisioner "file" {
source = "${path.module}/assets/FortuneService.json"
destination = "/etc/consul.d/FortuneService.json"
}
provisioner "file" {
source = "${path.module}/assets/FortuneSecureService.json"
destination = "FortuneSecureService.json"
}
provisioner "file" {
source = "${path.module}/assets/StartConsulClient.sh"
destination = "/usr/local/bin/StartConsul.sh"
}
provisioner "file" {
source = "${path.module}/assets/StartFortune.sh"
destination = "/usr/local/bin/StartFortune.sh"
}
provisioner "file" {
source = "${path.module}/assets/consul_install.sh"
destination = "consul_install.sh"
}
provisioner "remote-exec" {
inline = [
"bash consul_install.sh > consul_install.out",
"chmod 755 /usr/local/bin/StartConsul.sh",
"screen -dmS consul /usr/local/bin/StartConsul.sh",
"chmod 755 /usr/local/bin/StartFortune.sh",
"screen -dmS fortune /usr/local/bin/StartFortune.sh",
"sleep 10"
]
}
provisioner "file" {
source = "${path.module}/assets/vault-client-config.json"
destination = "/etc/vault.d/vault-client-config.json"
}
provisioner "file" {
source = "${path.module}/assets/StartVaultClient.sh"
destination = "/usr/local/bin/StartVaultClient.sh"
}
provisioner "file" {
source = "${path.module}/assets/vault_install.sh"
destination = "vault_install.sh"
}
provisioner "remote-exec" {
inline = [
"bash vault_install.sh > vault_install.out",
"chmod 755 /usr/local/bin/StartVaultClient.sh",
"screen -dmS vault /usr/local/bin/StartVaultClient.sh",
"sleep 10"
]
}
}