ansible-debops-infrastructure

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

commit 8c6e1417e60dbfcd896224890f3b83ab59bbfa83
parent e9a7088c1211b65f1904bfed67fafad8705824a3
Author: Dionysis Grigoropoulos <dgrig@erethon.com>
Date:   Sun,  3 Nov 2019 19:14:27 +0200

production: Initialize Network and Matrix VM

Diffstat:
terraform/infrastructure/production/main.tf | 37+++++++++++++++++++++++++++++++++++++
terraform/infrastructure/production/variables.tf | 14++++++++++++++
2 files changed, 51 insertions(+), 0 deletions(-)

diff --git a/terraform/infrastructure/production/main.tf b/terraform/infrastructure/production/main.tf @@ -0,0 +1,37 @@ +provider "libvirt" { + uri = "${var.libvirt_uri}" +} + +module "dev_network" { + source = "../../modules/libvirt_network" + + network_bridge_interface = "virbr1" + network_name = "dev_network" + network_cidr = var.libvirt_cidr + network_dns_enabled = false +} + +resource "libvirt_volume" "base_debian_volume" { + name = "debian_base_volume" + pool = var.libvirt_storage_pool + format = "qcow2" + source = "/data/disks/debian_10_base_volume" +} + +module "production_matrix" { + source = "../../modules/libvirt_host" + + host_name = "production_matrix" + storage_pool = var.libvirt_storage_pool + volume_name = "production_matrix_volume" + base_volume_id = libvirt_volume.base_debian_volume.id + disks = [{"volume_id": libvirt_volume.base_debian_volume.id}] + network_id = module.dev_network.id + network_cidr = module.dev_network.cidr + network_host = "2" + enable_cloud_init = true + cloudinit_user_template = <<EOF +runcmd: + - echo 'source /etc/network/interfaces.d/*' > /etc/network/interfaces +EOF +} diff --git a/terraform/infrastructure/production/variables.tf b/terraform/infrastructure/production/variables.tf @@ -0,0 +1,14 @@ +variable "libvirt_uri" { + description = "URI for libvirt to use" + default = "qemu+ssh://user@host/system" +} + +variable "libvirt_storage_pool" { + description = "Storage pool to use for VM disks" + default = "tf_pool" +} + +variable "libvirt_cidr" { + description = "Network CIDR to use for VMs" + default = "192.168.199.0/24" +}