Simple terraform+ansible configuration to quickly spin up a development Docker swarm on my homeserver
您最多能選擇 25 個主題 主題必須以字母或數字為開頭,可包含連接號 ('-') 且最長為 35 個字。
 
 

54 行
918 B

resource "libvirt_domain" "domain" {
count = var.node_count
name = "swarm-${count.index + 1}"
vcpu = var.node_vcpu
memory = var.node_memory
disk {
volume_id = libvirt_volume.root[count.index].id
}
cloudinit = libvirt_cloudinit_disk.cidata[count.index].id
console {
type = "pty"
target_port = "0"
target_type = "serial"
}
console {
type = "pty"
target_type = "virtio"
target_port = "1"
}
network_interface {
bridge = "br0"
}
provisioner "remote-exec" {
inline = [
"cloud-init status --wait",
"sudo shutdown -r +0"
]
connection {
type = "ssh"
user = "deploy"
host = "swarm-${count.index + 1}"
}
}
provisioner "remote-exec" {
inline = [
"echo 'ready'",
]
connection {
type = "ssh"
user = "deploy"
host = "swarm-${count.index + 1}"
}
}
}