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 (5543B)


      1 provider "libvirt" {
      2   uri = var.libvirt_uri
      3 }
      4 
      5 module "ori_network" {
      6   source = "../../modules/libvirt_network"
      7 
      8   network_bridge_interface = "virbr1"
      9   network_name             = "ori_network"
     10   network_cidr             = ["192.168.144.0/24"]
     11   network_dns_enabled      = false
     12 }
     13 
     14 resource "libvirt_volume" "base_debian_volume" {
     15   name   = "debian_base_volume"
     16   pool   = var.libvirt_storage_pool
     17   format = "qcow2"
     18   source = "/home/bsd/Disks/packer-debian10-base-v2"
     19 }
     20 
     21 resource "libvirt_volume" "base_debian_volume_v3" {
     22   name   = "debian_base_volume_v3"
     23   pool   = var.libvirt_storage_pool
     24   format = "qcow2"
     25   source = "/home/bsd/Disks/packer-debian10-base-v6"
     26 }
     27 
     28 resource "libvirt_volume" "base_debian_11_volume" {
     29   name   = "debian_base_11_volume"
     30   pool   = var.libvirt_storage_pool
     31   format = "qcow2"
     32   source = "/home/bsd/Disks/packer-debian11-base-v1"
     33 }
     34 
     35 resource "libvirt_volume" "base_openbsd_volume" {
     36   name   = "openbsd_base_volume"
     37   pool   = var.libvirt_storage_pool
     38   format = "qcow2"
     39   source = "/home/bsd/Disks/packer-openbsd7.0-base"
     40 }
     41 
     42 module "dirty_debian_dev" {
     43   source = "../../modules/libvirt_host"
     44 
     45   host_name               = "dirty_debian_dev"
     46   host_memory             = "2048"
     47   host_vcpu               = 2
     48   storage_pool            = var.libvirt_storage_pool
     49   volume_name             = "dirty_debian_dev"
     50   base_volume_id          = libvirt_volume.base_debian_11_volume.id
     51   disks                   = [{ "volume_id" : libvirt_volume.base_debian_11_volume.id }]
     52   network_id              = module.ori_network.id
     53   network_cidr            = module.ori_network.cidr[0]
     54   network_host            = "2"
     55   enable_cloud_init       = true
     56   cloudinit_user_template = <<EOF
     57   host_autostart          = false
     58 runcmd:
     59   - echo 'source /etc/network/interfaces.d/*' > /etc/network/interfaces
     60 EOF
     61 }
     62 
     63 module "nv_core" {
     64   source = "../../modules/libvirt_host"
     65 
     66   host_name               = "nv_core"
     67   host_memory             = "4096"
     68   host_vcpu               = 4
     69   storage_pool            = var.libvirt_storage_pool
     70   volume_name             = "nv_core"
     71   volume_size             = "21474836480"
     72   base_volume_id          = libvirt_volume.base_debian_volume_v3.id
     73   disks                   = [{ "volume_id" : libvirt_volume.base_debian_volume_v3.id }]
     74   network_id              = module.ori_network.id
     75   network_cidr            = module.ori_network.cidr[0]
     76   network_host            = "3"
     77   enable_cloud_init       = true
     78   cloudinit_user_template = <<EOF
     79   host_autostart          = false
     80 runcmd:
     81   - echo 'source /etc/network/interfaces.d/*' > /etc/network/interfaces
     82 EOF
     83 }
     84 
     85 module "openbsd_70" {
     86   source = "../../modules/libvirt_host"
     87 
     88   host_name         = "openbsd70"
     89   host_memory       = "2048"
     90   host_vcpu         = 2
     91   storage_pool      = var.libvirt_storage_pool
     92   volume_name       = "openbsd_70"
     93   base_volume_id    = libvirt_volume.base_openbsd_volume.id
     94   disks             = [{ "volume_id" : libvirt_volume.base_openbsd_volume.id }]
     95   network_id        = module.ori_network.id
     96   network_cidr      = module.ori_network.cidr[0]
     97   network_host      = "4"
     98   enable_cloud_init = false
     99   host_autostart    = false
    100 }
    101 
    102 module "xorg_enabled" {
    103   source = "../../modules/libvirt_host"
    104 
    105   host_name               = "xorg_enabled"
    106   host_memory             = "2048"
    107   host_vcpu               = 1
    108   storage_pool            = var.libvirt_storage_pool
    109   volume_name             = "xorg_enabled"
    110   base_volume_id          = libvirt_volume.base_debian_volume.id
    111   disks                   = [{ "volume_id" : libvirt_volume.base_debian_volume.id }]
    112   network_id              = module.ori_network.id
    113   network_cidr            = module.ori_network.cidr[0]
    114   network_host            = "5"
    115   enable_cloud_init       = true
    116   cloudinit_user_template = <<EOF
    117   host_autostart          = false
    118 runcmd:
    119   - echo 'source /etc/network/interfaces.d/*' > /etc/network/interfaces
    120 EOF
    121 }
    122 
    123 module "rust_dev" {
    124   source = "../../modules/libvirt_host"
    125 
    126   host_name               = "rust_dev"
    127   host_memory             = "4096"
    128   host_vcpu               = 4
    129   storage_pool            = var.libvirt_storage_pool
    130   volume_name             = "rust_dev"
    131   volume_size             = "16106127360"
    132   base_volume_id          = libvirt_volume.base_debian_volume.id
    133   disks                   = [{ "volume_id" : libvirt_volume.base_debian_volume.id }]
    134   network_id              = module.ori_network.id
    135   network_cidr            = module.ori_network.cidr[0]
    136   network_host            = "7"
    137   host_autostart          = false
    138   enable_cloud_init       = true
    139   cloudinit_user_template = <<EOF
    140 runcmd:
    141   - echo 'source /etc/network/interfaces.d/*' > /etc/network/interfaces
    142 EOF
    143 }
    144 
    145 module "kali_live" {
    146   source = "../../modules/libvirt_host"
    147 
    148   host_name       = "kali_live"
    149   host_memory     = "4096"
    150   host_vcpu       = 4
    151   storage_pool    = var.libvirt_storage_pool
    152   disks           = [{ "iso" : "/home/bsd/Disks/kali-linux-2020.4-live-amd64.iso" }]
    153   network_id      = module.ori_network.id
    154   network_cidr    = module.ori_network.cidr[0]
    155   network_host    = "22"
    156   enable_graphics = true
    157   host_autostart  = false
    158 }
    159 
    160 module "tails_live" {
    161   source = "../../modules/libvirt_host"
    162 
    163   host_name       = "tails_live"
    164   host_memory     = "4096"
    165   host_vcpu       = 6
    166   storage_pool    = var.libvirt_storage_pool
    167   disks           = [{ "iso" : "/home/bsd/Disks/tails-amd64-4.14.iso" }]
    168   network_id      = module.ori_network.id
    169   network_cidr    = module.ori_network.cidr[0]
    170   network_host    = "23"
    171   enable_graphics = true
    172   host_autostart  = false
    173 }