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


      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.2-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 "openbsd_72" {
     64   source = "../../modules/libvirt_host"
     65 
     66   host_name         = "openbsd72"
     67   host_memory       = "2048"
     68   host_vcpu         = 2
     69   storage_pool      = var.libvirt_storage_pool
     70   volume_name       = "openbsd_72"
     71   base_volume_id    = libvirt_volume.base_openbsd_volume.id
     72   disks             = [{ "volume_id" : libvirt_volume.base_openbsd_volume.id }]
     73   network_id        = module.ori_network.id
     74   network_cidr      = module.ori_network.cidr[0]
     75   network_host      = "4"
     76   enable_cloud_init = false
     77   host_autostart    = false
     78 }
     79 
     80 module "xorg_enabled" {
     81   source = "../../modules/libvirt_host"
     82 
     83   host_name               = "xorg_enabled"
     84   host_memory             = "2048"
     85   host_vcpu               = 1
     86   storage_pool            = var.libvirt_storage_pool
     87   volume_name             = "xorg_enabled"
     88   base_volume_id          = libvirt_volume.base_debian_volume.id
     89   disks                   = [{ "volume_id" : libvirt_volume.base_debian_volume.id }]
     90   network_id              = module.ori_network.id
     91   network_cidr            = module.ori_network.cidr[0]
     92   network_host            = "5"
     93   enable_cloud_init       = true
     94   cloudinit_user_template = <<EOF
     95   host_autostart          = false
     96 runcmd:
     97   - echo 'source /etc/network/interfaces.d/*' > /etc/network/interfaces
     98 EOF
     99 }
    100 
    101 module "rust_dev" {
    102   source = "../../modules/libvirt_host"
    103 
    104   host_name               = "rust_dev"
    105   host_memory             = "4096"
    106   host_vcpu               = 4
    107   storage_pool            = var.libvirt_storage_pool
    108   volume_name             = "rust_dev"
    109   volume_size             = "16106127360"
    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            = "7"
    115   host_autostart          = false
    116   enable_cloud_init       = true
    117   cloudinit_user_template = <<EOF
    118 runcmd:
    119   - echo 'source /etc/network/interfaces.d/*' > /etc/network/interfaces
    120 EOF
    121 }
    122 
    123 module "kali_live" {
    124   source = "../../modules/libvirt_host"
    125 
    126   host_name       = "kali_live"
    127   host_memory     = "4096"
    128   host_vcpu       = 4
    129   storage_pool    = var.libvirt_storage_pool
    130   disks           = [{ "iso" : "/home/bsd/Disks/kali-linux-2020.4-live-amd64.iso" }]
    131   network_id      = module.ori_network.id
    132   network_cidr    = module.ori_network.cidr[0]
    133   network_host    = "22"
    134   enable_graphics = true
    135   host_autostart  = false
    136 }
    137 
    138 module "tails_live" {
    139   source = "../../modules/libvirt_host"
    140 
    141   host_name       = "tails_live"
    142   host_memory     = "4096"
    143   host_vcpu       = 6
    144   storage_pool    = var.libvirt_storage_pool
    145   disks           = [{ "iso" : "/home/bsd/Disks/tails-amd64-5.6.iso" }]
    146   network_id      = module.ori_network.id
    147   network_cidr    = module.ori_network.cidr[0]
    148   network_host    = "23"
    149   enable_graphics = true
    150   host_autostart  = false
    151 }
    152 
    153 module "red_team_oricono" {
    154   source = "../../modules/libvirt_host"
    155 
    156   host_name               = "red_team_oricono"
    157   host_memory             = "2048"
    158   host_vcpu               = 2
    159   storage_pool            = var.libvirt_storage_pool
    160   volume_name             = "red_team_oricono"
    161   base_volume_id          = libvirt_volume.base_debian_11_volume.id
    162   disks                   = [{ "volume_id" : libvirt_volume.base_debian_11_volume.id }]
    163   network_id              = module.ori_network.id
    164   network_cidr            = module.ori_network.cidr[0]
    165   network_host            = "3"
    166   enable_cloud_init       = true
    167   cloudinit_user_template = <<EOF
    168   host_autostart          = false
    169 runcmd:
    170   - echo 'source /etc/network/interfaces.d/*' > /etc/network/interfaces
    171 EOF
    172 }