-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker.tf
109 lines (98 loc) · 2.19 KB
/
docker.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
resource "proxmox_vm_qemu" "docker-host-1" {
os_type = "cloud-init"
count = 2
clone = var.template
name = "docker-${count.index + 1}"
target_node = "host-1"
onboot = true
agent = 0
qemu_os = "other"
tags = "docker"
cores = 4
memory = 8192
bios = "seabios"
scsihw = "virtio-scsi-pci"
ipconfig0 = "ip=192.168.2.${count.index + 24}/24,gw=192.168.2.1"
sshkeys = join("", [for key in var.public_ssh_keys : file(key)])
disks {
ide {
ide2 {
cloudinit {
storage = "images"
}
}
}
scsi {
scsi0 {
disk {
asyncio = "threads"
iothread = true
storage = "images"
size = "100G"
}
}
}
}
network {
model = "virtio"
bridge = "vmbr0"
}
connection {
type = "ssh"
user = "ubuntu"
private_key = file(var.private_ssh_key)
host = "192.168.2.${count.index + 24}"
}
provisioner "remote-exec" {
inline = ["sudo apt update", "sudo apt install python3 -y"]
}
}
resource "proxmox_vm_qemu" "docker-host-2" {
os_type = "cloud-init"
count = 2
clone = var.template
name = "docker-${count.index + 3}"
target_node = "host-2"
onboot = true
agent = 0
qemu_os = "other"
tags = "docker"
cores = 4
memory = 8192
bios = "seabios"
scsihw = "virtio-scsi-pci"
ipconfig0 = "ip=192.168.2.${count.index + 26}/24,gw=192.168.2.1"
sshkeys = join("", [for key in var.public_ssh_keys : file(key)])
disks {
ide {
ide2 {
cloudinit {
storage = "images"
}
}
}
scsi {
scsi0 {
disk {
asyncio = "threads"
iothread = true
storage = "images"
size = "100G"
}
}
}
}
network {
model = "virtio"
bridge = "vmbr0"
}
connection {
type = "ssh"
user = "ubuntu"
private_key = file(var.private_ssh_key)
host = "192.168.2.${count.index + 26}"
}
provisioner "remote-exec" {
inline = ["sudo apt update", "sudo apt install python3 -y"]
}
}