ansible-debops-infrastructure

DebOps and Ansible scripts to manage my infrastructure
git clone git://git.erethon.com/ansible-debops-infrastructure
Log | Files | Refs

main.tf (1412B)


      1 provider "libvirt" {
      2   uri = var.libvirt_uri
      3 }
      4 
      5 module "autonomous_network" {
      6   source = "../../modules/libvirt_network"
      7 
      8   network_bridge_interface = "virbr1"
      9   network_name             = "autonomous_network"
     10   network_cidr             = ["192.168.133.0/24", "2a01:4f8:211:1418::/116"]
     11   network_dns_enabled      = false
     12 }
     13 
     14 resource "libvirt_pool" "tf_pool" {
     15   name = var.libvirt_storage_pool
     16   type = "dir"
     17   path = "/opt/Disks/${var.libvirt_storage_pool}"
     18 }
     19 
     20 resource "libvirt_volume" "base_debian_volume" {
     21   name   = "debian_base_volume"
     22   pool   = var.libvirt_storage_pool
     23   format = "qcow2"
     24   source = "/opt/Disks/packer-debian10-base"
     25 }
     26 
     27 module "k3s_1" {
     28   source   = "../../modules/libvirt_host"
     29   for_each = toset(["2", "3", "4"])
     30 
     31   host_name               = "k3s_${each.key}"
     32   host_memory             = "2048"
     33   host_vcpu               = 2
     34   storage_pool            = var.libvirt_storage_pool
     35   volume_name             = "k3s_${each.key}"
     36   base_volume_id          = libvirt_volume.base_debian_volume.id
     37   disks                   = [{ "volume_id" : libvirt_volume.base_debian_volume.id }]
     38   network_id              = module.autonomous_network.id
     39   network_cidr            = module.autonomous_network.cidr[0]
     40   network_host            = each.key
     41   enable_cloud_init       = true
     42   cloudinit_user_template = <<EOF
     43 runcmd:
     44   - echo 'source /etc/network/interfaces.d/*' > /etc/network/interfaces
     45 EOF
     46 }