Simple terraform+ansible configuration to quickly spin up a development Docker swarm on my homeserver
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

23 lines
598 B

  1. data "template_file" "user_data" {
  2. count = var.node_count
  3. template = file("${path.module}/files/user_data.cfg")
  4. vars = {
  5. pubkey = file("~/.ssh/id_rsa.pub")
  6. }
  7. }
  8. data "template_file" "meta_data" {
  9. count = var.node_count
  10. template = file("${path.module}/files/meta_data.cfg")
  11. vars = {
  12. hostname = "swarm-${count.index + 1}"
  13. }
  14. }
  15. resource "libvirt_cloudinit_disk" "cidata" {
  16. count = var.node_count
  17. name = "swarm-${count.index + 1}-cidata.iso"
  18. user_data = data.template_file.user_data[count.index].rendered
  19. meta_data = data.template_file.meta_data[count.index].rendered
  20. }