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


      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_openbsd_volume" {
     29   name   = "openbsd_base_volume"
     30   pool   = var.libvirt_storage_pool
     31   format = "qcow2"
     32   source = "/home/bsd/Disks/packer-openbsd6.9-base"
     33 }
     34 
     35 module "dirty_debian_dev" {
     36   source = "../../modules/libvirt_host"
     37 
     38   host_name               = "dirty_debian_dev"
     39   host_memory             = "2048"
     40   host_vcpu               = 2
     41   storage_pool            = var.libvirt_storage_pool
     42   volume_name             = "dirty_debian_dev"
     43   base_volume_id          = libvirt_volume.base_debian_volume.id
     44   disks                   = [{ "volume_id" : libvirt_volume.base_debian_volume.id }]
     45   network_id              = module.ori_network.id
     46   network_cidr            = module.ori_network.cidr[0]
     47   network_host            = "2"
     48   enable_cloud_init       = true
     49   cloudinit_user_template = <<EOF
     50 runcmd:
     51   - echo 'source /etc/network/interfaces.d/*' > /etc/network/interfaces
     52 EOF
     53 }
     54 
     55 module "nv_core" {
     56   source = "../../modules/libvirt_host"
     57 
     58   host_name               = "nv_core"
     59   host_memory             = "4096"
     60   host_vcpu               = 1
     61   storage_pool            = var.libvirt_storage_pool
     62   volume_name             = "nv_core"
     63   volume_size             = "21474836480"
     64   base_volume_id          = libvirt_volume.base_debian_volume_v3.id
     65   disks                   = [{ "volume_id" : libvirt_volume.base_debian_volume_v3.id }]
     66   network_id              = module.ori_network.id
     67   network_cidr            = module.ori_network.cidr[0]
     68   network_host            = "3"
     69   enable_cloud_init       = true
     70   cloudinit_user_template = <<EOF
     71 runcmd:
     72   - echo 'source /etc/network/interfaces.d/*' > /etc/network/interfaces
     73 EOF
     74 }
     75 
     76 module "openbsd_69" {
     77   source = "../../modules/libvirt_host"
     78 
     79   host_name         = "openbsd69"
     80   host_memory       = "2048"
     81   host_vcpu         = 1
     82   storage_pool      = var.libvirt_storage_pool
     83   volume_name       = "openbsd_69"
     84   base_volume_id    = libvirt_volume.base_openbsd_volume.id
     85   disks             = [{ "volume_id" : libvirt_volume.base_openbsd_volume.id }]
     86   network_id        = module.ori_network.id
     87   network_cidr      = module.ori_network.cidr[0]
     88   network_host      = "4"
     89   enable_cloud_init = false
     90   host_autostart    = false
     91 }
     92 
     93 module "xorg_enabled" {
     94   source = "../../modules/libvirt_host"
     95 
     96   host_name               = "xorg_enabled"
     97   host_memory             = "2048"
     98   host_vcpu               = 1
     99   storage_pool            = var.libvirt_storage_pool
    100   volume_name             = "xorg_enabled"
    101   base_volume_id          = libvirt_volume.base_debian_volume.id
    102   disks                   = [{ "volume_id" : libvirt_volume.base_debian_volume.id }]
    103   network_id              = module.ori_network.id
    104   network_cidr            = module.ori_network.cidr[0]
    105   network_host            = "5"
    106   enable_cloud_init       = true
    107   cloudinit_user_template = <<EOF
    108 runcmd:
    109   - echo 'source /etc/network/interfaces.d/*' > /etc/network/interfaces
    110 EOF
    111 }
    112 
    113 module "rust_dev" {
    114   source = "../../modules/libvirt_host"
    115 
    116   host_name               = "rust_dev"
    117   host_memory             = "4096"
    118   host_vcpu               = 4
    119   storage_pool            = var.libvirt_storage_pool
    120   volume_name             = "rust_dev"
    121   volume_size             = "16106127360"
    122   base_volume_id          = libvirt_volume.base_debian_volume.id
    123   disks                   = [{ "volume_id" : libvirt_volume.base_debian_volume.id }]
    124   network_id              = module.ori_network.id
    125   network_cidr            = module.ori_network.cidr[0]
    126   network_host            = "7"
    127   host_autostart          = false
    128   enable_cloud_init       = true
    129   cloudinit_user_template = <<EOF
    130 runcmd:
    131   - echo 'source /etc/network/interfaces.d/*' > /etc/network/interfaces
    132 EOF
    133 }
    134 
    135 module "kali_live" {
    136   source = "../../modules/libvirt_host"
    137 
    138   host_name       = "kali_live"
    139   host_memory     = "4096"
    140   host_vcpu       = 4
    141   storage_pool    = var.libvirt_storage_pool
    142   disks           = [{ "iso" : "/home/bsd/Disks/kali-linux-2020.4-live-amd64.iso" }]
    143   network_id      = module.ori_network.id
    144   network_cidr    = module.ori_network.cidr[0]
    145   network_host    = "22"
    146   enable_graphics = true
    147   host_autostart  = false
    148 }
    149 
    150 module "tails_live" {
    151   source = "../../modules/libvirt_host"
    152 
    153   host_name       = "tails_live"
    154   host_memory     = "4096"
    155   host_vcpu       = 6
    156   storage_pool    = var.libvirt_storage_pool
    157   disks           = [{ "iso" : "/home/bsd/Disks/tails-amd64-4.14.iso" }]
    158   network_id      = module.ori_network.id
    159   network_cidr    = module.ori_network.cidr[0]
    160   network_host    = "23"
    161   enable_graphics = true
    162   host_autostart  = false
    163 }