ansible-debops-infrastructure

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

commit 32841f80581aacd3cf888ab13d5d6b9ce6d3891f
parent 000cfc0c4a5514adaa0e1935bbcba45e6c6b244f
Author: Dionysis Grigoropoulos <dgrig@erethon.com>
Date:   Sat,  5 Sep 2020 21:16:52 +0300

lenny: Initialize Terraform directory for lenny

Diffstat:
terraform/infrastructure/lenny/main.tf | 88+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
terraform/infrastructure/lenny/variables.tf | 4++++
terraform/infrastructure/lenny/versions.tf | 9+++++++++
3 files changed, 101 insertions(+), 0 deletions(-)

diff --git a/terraform/infrastructure/lenny/main.tf b/terraform/infrastructure/lenny/main.tf @@ -0,0 +1,88 @@ +provider "libvirt" { + uri = var.libvirt_uri +} + +module "lenny_network" { + source = "../../modules/libvirt_network" + + network_bridge_interface = "virbr1" + network_name = "lenny_network" + network_cidr = "192.168.134.0/24" + network_dns_enabled = false +} + +resource "libvirt_volume" "base_debian_volume" { + name = "debian_base_volume" + pool = libvirt_pool.disk_pool.name + format = "qcow2" + source = "/home/tp/Disks/packer-debian10-base-v2" +} + +resource "libvirt_pool" "disk_pool" { + name = "tf_pool" + type = "dir" + path = "/data/Disks" +} + +module "dirty_debian_dev" { + source = "../../modules/libvirt_host" + + host_name = "dirty_debian_dev" + host_memory = "512" + host_vcpu = 1 + host_autostart = false + storage_pool = libvirt_pool.disk_pool.name + volume_name = "dirty_debian_dev" + base_volume_id = libvirt_volume.base_debian_volume.id + disks = [{"volume_id": libvirt_volume.base_debian_volume.id}] + network_id = module.lenny_network.id + network_cidr = module.lenny_network.cidr + network_host = "2" + enable_cloud_init = true + cloudinit_user_template = <<EOF +runcmd: + - echo 'source /etc/network/interfaces.d/*' > /etc/network/interfaces +EOF +} + +module "nv_core" { + source = "../../modules/libvirt_host" + + host_name = "nc_core" + host_memory = "512" + host_vcpu = 1 + host_autostart = false + storage_pool = libvirt_pool.disk_pool.name + volume_name = "nv_core" + base_volume_id = libvirt_volume.base_debian_volume.id + disks = [{"volume_id": libvirt_volume.base_debian_volume.id}] + network_id = module.lenny_network.id + network_cidr = module.lenny_network.cidr + network_host = "3" + enable_cloud_init = true + cloudinit_user_template = <<EOF +runcmd: + - echo 'source /etc/network/interfaces.d/*' > /etc/network/interfaces +EOF +} + +module "tor_proxy" { + source = "../../modules/libvirt_host" + + host_name = "tor_proxy" + host_memory = "256" + host_vcpu = 1 + host_autostart = false + storage_pool = libvirt_pool.disk_pool.name + volume_name = "tor_proxy" + base_volume_id = libvirt_volume.base_debian_volume.id + disks = [{"volume_id": libvirt_volume.base_debian_volume.id}] + network_id = module.lenny_network.id + network_cidr = module.lenny_network.cidr + network_host = "4" + enable_cloud_init = true + cloudinit_user_template = <<EOF +runcmd: + - echo 'source /etc/network/interfaces.d/*' > /etc/network/interfaces +EOF +} diff --git a/terraform/infrastructure/lenny/variables.tf b/terraform/infrastructure/lenny/variables.tf @@ -0,0 +1,4 @@ +variable "libvirt_uri" { + description = "URI for libvirt to use" + default = "qemu:///system" +} diff --git a/terraform/infrastructure/lenny/versions.tf b/terraform/infrastructure/lenny/versions.tf @@ -0,0 +1,9 @@ +terraform { + required_providers { + libvirt = { + source = "erethon.com/third-party/libvirt" + version = "0.6.2" + } + } + required_version = ">= 0.13" +}