Simple terraform+ansible configuration to quickly spin up a development Docker swarm on my homeserver
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 

26 rindas
680 B

data "template_file" "inventory" {
template = "${file("files/ansible_hosts.tpl")}"
depends_on = [
"libvirt_domain.domain",
]
vars = {
managers = "${join("\n", slice(libvirt_domain.domain.*.name, 0, 3))}"
workers = "${join("\n", slice(libvirt_domain.domain.*.name, 3, length(libvirt_domain.domain.*.name)))}"
}
}
resource "null_resource" "ansible" {
triggers = {
template_rendered = "${data.template_file.inventory.rendered}"
}
provisioner "local-exec" {
command = "echo '${data.template_file.inventory.rendered}' > ansible/hosts"
}
provisioner "local-exec" {
command = "cd ansible && ansible-playbook --diff provision.yaml"
}
}