-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path8-deploy-domain.tf
71 lines (59 loc) · 1.56 KB
/
8-deploy-domain.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
resource "libvirt_cloudinit_disk" "deploy-cloudinit" {
pool = "default"
name = "${var.project-name}-deploy-cloudinit.iso"
user_data = data.template_file.deploy_user_data.rendered
meta_data = data.template_file.deploy_metadata.rendered
network_config = data.template_file.deploy_network_config.rendered
}
resource "libvirt_domain" "deploy-instance" {
name = format("%s-%s", var.project-name, "deploy")
memory = "4096"
vcpu = 2
cloudinit = libvirt_cloudinit_disk.deploy-cloudinit.id
disk {
volume_id = libvirt_volume.deployroot.id
}
disk {
volume_id = libvirt_volume.deploydisk.id
}
console {
type = "pty"
target_type = "serial"
target_port = "0"
}
graphics {
type = "spice"
listen_type = "address"
autoport = true
}
# deploy network
network_interface {
network_id = libvirt_network.deploy.id
addresses = ["${var.deploy-addr}.${var.deploy-ipnum}"]
wait_for_lease = false
}
# storage network
network_interface {
network_id = libvirt_network.monitor.id
addresses = ["${var.storage-addr}.${var.deploy-ipnum}"]
wait_for_lease = false
}
# external network
network_interface {
#network_name = "${var.project-name}-external"
network_name = "default"
addresses = ["${var.external-addr}.${var.deploy-ipnum}"]
wait_for_lease = false
}
connection {
type = "ssh"
user = "root"
password = "root123"
host = "${var.external-addr}.${var.deploy-ipnum}"
}
provisioner "remote-exec" {
inline = [
"yum install -y qemu-guest-agent git"
]
}
}