ansible-debops-infrastructure

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

commit fe7d44ebde82475b1fe5f6a228d66eeeefdcaaeb
parent 5c0be59633111cd647d1ec90e456f48a07fc8f5c
Author: Dionysis Grigoropoulos <dgrig@erethon.com>
Date:   Tue, 22 Jan 2019 23:24:37 +0200

tf: Initialize development and jenkins hosts

Diffstat:
terraform/infrastructure/main.tf | 94+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
terraform/infrastructure/variables.tf | 5+++++
2 files changed, 99 insertions(+), 0 deletions(-)

diff --git a/terraform/infrastructure/main.tf b/terraform/infrastructure/main.tf @@ -2,6 +2,13 @@ provider "libvirt" { uri = "${var.libvirt_uri}" } +resource "libvirt_volume" "debian_jenkins" { + name = "debian_jenkins" + pool = "${var.libvirt_storage_pool}" + format = "qcow2" + size = 21474836480 +} + resource "libvirt_volume" "debian_dev" { name = "debian_dev" pool = "${var.libvirt_storage_pool}" @@ -23,3 +30,90 @@ resource "libvirt_network" "dev_network" { autostart = true bridge = "virbr1" } + +resource "libvirt_volume" "obsd_dn42" { + name = "obsd_dn42" + pool = "${var.libvirt_storage_pool}" + format = "qcow2" + size = 10737418240 +} + +resource "libvirt_domain" "obsd_dev_domain" { + name = "obsd_dev" + memory = "1024" + vcpu = 2 + autostart = "true" + + boot_device { + dev = ["hd"] + } + + ## Not needed after initial installation + ## disk { + ## file = "${var.openbsd_iso}" + ## } + + disk { + volume_id = "${libvirt_volume.obsd_dev.id}" + } + + network_interface { + network_id = "${libvirt_network.dev_network.id}" + addresses = ["192.168.199.2"] + } + + graphics { + type = "spice" + listen_type = "none" + } +} + +resource "libvirt_domain" "debian_jenkins_domain" { + name = "debian_jenkins" + memory = "2048" + vcpu = 2 + autostart = "true" + + boot_device { + dev = ["hd"] + } + + disk { + volume_id = "${libvirt_volume.debian_jenkins.id}" + } + + network_interface { + network_id = "${libvirt_network.dev_network.id}" + addresses = ["192.168.199.3"] + } + + graphics { + type = "spice" + listen_type = "none" + } +} + +resource "libvirt_domain" "debian_dev_domain" { + name = "debian_dev" + memory = "512" + vcpu = 1 + autostart = "true" + + boot_device { + dev = ["hd"] + } + + disk { + volume_id = "${libvirt_volume.debian_dev.id}" + } + + network_interface { + network_id = "${libvirt_network.dev_network.id}" + addresses = ["192.168.199.4"] + } + + graphics { + type = "spice" + listen_type = "none" + } +} diff --git a/terraform/infrastructure/variables.tf b/terraform/infrastructure/variables.tf @@ -12,3 +12,8 @@ variable "libvirt_cidr" { description = "Network CIDR to use for VMs" default = ["192.168.199.0/24"] } + +variable "openbsd_iso" { + description = "OpenBSD installation ISO to use" + default = "/data/iso/install64.iso" +}