-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfio.tf
More file actions
76 lines (67 loc) · 1.81 KB
/
fio.tf
File metadata and controls
76 lines (67 loc) · 1.81 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
resource "null_resource" "run_fio_server" {
triggers = {
a = timestamp()
}
count = var.instance_num
connection {
type = "ssh"
user = "ansible"
password = var.root_pass
host = openstack_compute_instance_v2.my_instance[count.index].access_ip_v4
}
provisioner "file" {
source = "templates/fio-server.service.tpl"
destination = "/tmp/fio-server.service"
}
provisioner "remote-exec" {
inline = [
"echo 'Waiting for user data script to finish'",
"cloud-init status --wait > /dev/null",
"sudo mv /tmp/fio-server.service /etc/systemd/system/fio-server.service",
"sudo chown root:root /etc/systemd/system/fio-server.service",
"sudo restorecon /etc/systemd/system/fio-server.service",
"sudo systemctl daemon-reload",
"sudo systemctl start fio-server.service",
"sleep 60"
]
}
}
resource "null_resource" "prepare_results_dir" {
triggers = {
a = timestamp()
}
provisioner "local-exec" {
command = "mkdir -p ${var.results_dir}/${var.test_type}"
}
}
resource "null_resource" "run_fio_client" {
depends_on = [null_resource.run_fio_server]
triggers = {
a = timestamp()
}
count = var.instance_num
provisioner "local-exec" {
command = format("fio --output %s/%s/%s --output-format %s --client=%s fio/%s",
var.results_dir,
var.test_type,
count.index,
var.fio_output_format,
openstack_compute_instance_v2.my_instance[count.index].access_ip_v4,
var.test_type
)
}
}
resource "null_resource" "fix_fio_resuls" {
depends_on = [null_resource.run_fio_client]
triggers = {
a = timestamp()
}
count = var.instance_num
provisioner "local-exec" {
command = format("sed -i '1,/^$/d' %s/%s/%s",
var.results_dir,
var.test_type,
count.index,
)
}
}