change directory structure
This commit is contained in:
parent
a172a02fe1
commit
99d88677f9
18 changed files with 226 additions and 155 deletions
75
terraform/main.tf
Normal file
75
terraform/main.tf
Normal file
|
@ -0,0 +1,75 @@
|
|||
terraform {
|
||||
backend "pg" {
|
||||
schema_name = "bootstrap"
|
||||
conn_str = "postgres://terraform@10.42.0.1/terraform_state"
|
||||
}
|
||||
|
||||
required_providers {
|
||||
libvirt = {
|
||||
source = "dmacvicar/libvirt"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
provider "libvirt" {
|
||||
uri = "qemu+ssh://root@atlas.lan/system"
|
||||
}
|
||||
|
||||
resource "libvirt_pool" "iso" {
|
||||
name = "iso"
|
||||
type = "dir"
|
||||
path = "/kvm/iso"
|
||||
}
|
||||
|
||||
resource "libvirt_pool" "disk" {
|
||||
name = "disk"
|
||||
type = "dir"
|
||||
path = "/kvm/disk"
|
||||
}
|
||||
|
||||
resource "libvirt_pool" "init" {
|
||||
name = "init"
|
||||
type = "dir"
|
||||
path = "/kvm/init"
|
||||
}
|
||||
|
||||
resource "libvirt_pool" "data" {
|
||||
name = "data"
|
||||
type = "dir"
|
||||
path = "/kvm/data"
|
||||
|
||||
xml {
|
||||
xslt = file("set_volume_pool_mode_open.xsl")
|
||||
}
|
||||
}
|
||||
|
||||
resource "libvirt_volume" "ubuntu_jammy" {
|
||||
name = "ubuntu-jammy.img"
|
||||
pool = "iso"
|
||||
source = "https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64.img"
|
||||
}
|
||||
|
||||
resource "libvirt_volume" "debian_bullseye" {
|
||||
name = "debian-bullseye.iso"
|
||||
pool = "iso"
|
||||
source = "https://cloud.debian.org/images/cloud/bullseye/latest/debian-11-generic-amd64.qcow2"
|
||||
}
|
||||
|
||||
resource "libvirt_volume" "debian_bookworm" {
|
||||
name = "debian-bookworm.qcow2"
|
||||
pool = "iso"
|
||||
source = "https://cloud.debian.org/images/cloud/bookworm/daily/latest/debian-12-generic-amd64-daily.qcow2"
|
||||
}
|
||||
|
||||
resource "libvirt_network" "dmzbr" {
|
||||
name = "dmzbr"
|
||||
mode = "bridge"
|
||||
bridge = "dmzbr"
|
||||
dhcp {
|
||||
enabled = false
|
||||
}
|
||||
dns {
|
||||
enabled = false
|
||||
}
|
||||
autostart = true
|
||||
}
|
19
terraform/set_volume_pool_mode_open.xsl
Normal file
19
terraform/set_volume_pool_mode_open.xsl
Normal file
|
@ -0,0 +1,19 @@
|
|||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
<xsl:output omit-xml-declaration="yes" indent="yes"/>
|
||||
|
||||
<xsl:template match="@*|node()">
|
||||
<xsl:copy>
|
||||
<xsl:apply-templates select="@*|node()" />
|
||||
</xsl:copy>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="/pool/target">
|
||||
<xsl:copy>
|
||||
<xsl:apply-templates select="@*|node()" />
|
||||
<permissions>
|
||||
<mode>0755</mode>
|
||||
</permissions>
|
||||
</xsl:copy>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
Reference in a new issue