Browse Source

portgroups are now configurable

main
Nicolas Massé 5 years ago
parent
commit
ccdb291e43
  1. 2
      bootstrap.tf
  2. 2
      lb.tf
  3. 2
      master.tf
  4. 25
      portgroups/lab16.xslt
  5. 25
      portgroups/lab32.xslt
  6. 25
      portgroups/lab48.xslt
  7. 25
      portgroups/lab7.xslt
  8. 0
      portgroups/lab8.xslt
  9. 2
      storage.tf
  10. 5
      variables.tf
  11. 2
      worker.tf

2
bootstrap.tf

@ -54,6 +54,6 @@ resource "libvirt_domain" "bootstrap" {
} }
xml { xml {
xslt = file("${path.module}/network.xslt") xslt = file("${path.module}/portgroups/${var.network_portgroup}.xslt")
} }
} }

2
lb.tf

@ -70,6 +70,6 @@ resource "libvirt_domain" "lb" {
} }
xml { xml {
xslt = file("${path.module}/network.xslt") xslt = file("${path.module}/portgroups/${var.network_portgroup}.xslt")
} }
} }

2
master.tf

@ -50,6 +50,6 @@ resource "libvirt_domain" "master" {
} }
xml { xml {
xslt = file("${path.module}/network.xslt") xslt = file("${path.module}/portgroups/${var.network_portgroup}.xslt")
} }
} }

25
portgroups/lab16.xslt

@ -0,0 +1,25 @@
<?xml version="1.0" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<!-- Target portgroup -->
<xsl:param name="portgroup" select="'lab16'"/>
<!-- XSLT Identity template -->
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<!-- Put the NIC in the desired portgroup -->
<xsl:template match="/domain/devices/interface/source">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
<xsl:attribute name="portgroup">
<xsl:value-of select="$portgroup"/>
</xsl:attribute>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>

25
portgroups/lab32.xslt

@ -0,0 +1,25 @@
<?xml version="1.0" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<!-- Target portgroup -->
<xsl:param name="portgroup" select="'lab32'"/>
<!-- XSLT Identity template -->
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<!-- Put the NIC in the desired portgroup -->
<xsl:template match="/domain/devices/interface/source">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
<xsl:attribute name="portgroup">
<xsl:value-of select="$portgroup"/>
</xsl:attribute>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>

25
portgroups/lab48.xslt

@ -0,0 +1,25 @@
<?xml version="1.0" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<!-- Target portgroup -->
<xsl:param name="portgroup" select="'lab48'"/>
<!-- XSLT Identity template -->
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<!-- Put the NIC in the desired portgroup -->
<xsl:template match="/domain/devices/interface/source">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
<xsl:attribute name="portgroup">
<xsl:value-of select="$portgroup"/>
</xsl:attribute>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>

25
portgroups/lab7.xslt

@ -0,0 +1,25 @@
<?xml version="1.0" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<!-- Target portgroup -->
<xsl:param name="portgroup" select="'lab7'"/>
<!-- XSLT Identity template -->
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<!-- Put the NIC in the desired portgroup -->
<xsl:template match="/domain/devices/interface/source">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
<xsl:attribute name="portgroup">
<xsl:value-of select="$portgroup"/>
</xsl:attribute>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>

0
network.xslt → portgroups/lab8.xslt

2
storage.tf

@ -73,6 +73,6 @@ resource "libvirt_domain" "storage" {
} }
xml { xml {
xslt = file("${path.module}/network.xslt") xslt = file("${path.module}/portgroups/${var.network_portgroup}.xslt")
} }
} }

5
variables.tf

@ -48,6 +48,11 @@ variable "network_name" {
default = "lab" default = "lab"
} }
variable "network_portgroup" {
type = string
default = "lab8"
}
variable "network_ip_range" { variable "network_ip_range" {
type = string type = string
default = "192.168.7.0/24" default = "192.168.7.0/24"

2
worker.tf

@ -50,6 +50,6 @@ resource "libvirt_domain" "worker" {
} }
xml { xml {
xslt = file("${path.module}/network.xslt") xslt = file("${path.module}/portgroups/${var.network_portgroup}.xslt")
} }
} }

Loading…
Cancel
Save