Merge pull request 'feat: add ausyd1nxvm2062 as image host' (#4) from benvin/add_incus_remote_node into master
Reviewed-on: https://git.query.consul/unkin/terraform-incus/pulls/4
This commit is contained in:
commit
06fc648c1c
3
config/nodes/ausyd1nxvm2062_images/config.yaml
Normal file
3
config/nodes/ausyd1nxvm2062_images/config.yaml
Normal file
@ -0,0 +1,3 @@
|
||||
---
|
||||
node_addr: 198.18.27.62
|
||||
node_port: 8443
|
||||
8
config/nodes/ausyd1nxvm2062_images/images.yaml
Normal file
8
config/nodes/ausyd1nxvm2062_images/images.yaml
Normal file
@ -0,0 +1,8 @@
|
||||
almalinux/8/cloud:
|
||||
remote: images
|
||||
aliases:
|
||||
- almalinux8
|
||||
almalinux/9/cloud:
|
||||
remote: images
|
||||
aliases:
|
||||
- almalinux9
|
||||
8
config/nodes/ausyd1nxvm2062_images/networks.yaml
Normal file
8
config/nodes/ausyd1nxvm2062_images/networks.yaml
Normal file
@ -0,0 +1,8 @@
|
||||
brcom1:
|
||||
type: bridge
|
||||
config:
|
||||
bridge.mtu: 1500
|
||||
ipv4.address: 10.255.255.1/24
|
||||
ipv4.nat: true
|
||||
dns.mode: none
|
||||
dns.domain: main.unkin.net
|
||||
22
config/nodes/ausyd1nxvm2062_images/profiles.yaml
Normal file
22
config/nodes/ausyd1nxvm2062_images/profiles.yaml
Normal file
@ -0,0 +1,22 @@
|
||||
# build profile
|
||||
build:
|
||||
description: "profile to use when building images"
|
||||
project: null
|
||||
config:
|
||||
boot.autostart: true
|
||||
limits.cpu: 1
|
||||
limits.memory: 1024MB
|
||||
limits.memory.enforce: hard
|
||||
limits.memory.swap: true
|
||||
devices:
|
||||
- type: nic
|
||||
name: eth0
|
||||
properties:
|
||||
parent: brcom1
|
||||
nictype: bridged
|
||||
- type: disk
|
||||
name: root
|
||||
properties:
|
||||
pool: fastpool
|
||||
size: 10GB
|
||||
path: /
|
||||
5
config/nodes/ausyd1nxvm2062_images/storage_pools.yaml
Normal file
5
config/nodes/ausyd1nxvm2062_images/storage_pools.yaml
Normal file
@ -0,0 +1,5 @@
|
||||
fastpool:
|
||||
driver: dir
|
||||
description: nvme backed pool
|
||||
config:
|
||||
source: /var/lib/incus/storage-pools/fastpool
|
||||
3
config/nodes/ausyd1nxvm2062_images/storage_volumes.yaml
Normal file
3
config/nodes/ausyd1nxvm2062_images/storage_volumes.yaml
Normal file
@ -0,0 +1,3 @@
|
||||
imagestore:
|
||||
pool: fastpool
|
||||
description: location to store images
|
||||
50
config/nodes/ausyd1nxvm2062_images/terragrunt.hcl
Normal file
50
config/nodes/ausyd1nxvm2062_images/terragrunt.hcl
Normal file
@ -0,0 +1,50 @@
|
||||
locals {
|
||||
config = yamldecode(file("${get_terragrunt_dir()}/config.yaml"))
|
||||
local_images = yamldecode(file("${get_terragrunt_dir()}/images.yaml"))
|
||||
local_networks = yamldecode(file("${get_terragrunt_dir()}/networks.yaml"))
|
||||
local_profiles = yamldecode(file("${get_terragrunt_dir()}/profiles.yaml"))
|
||||
local_storage_pools = yamldecode(file("${get_terragrunt_dir()}/storage_pools.yaml"))
|
||||
local_storage_volumes = yamldecode(file("${get_terragrunt_dir()}/storage_volumes.yaml"))
|
||||
node_name = basename(get_terragrunt_dir())
|
||||
}
|
||||
|
||||
# on the image server we want to use localised settings mostly, not all the globals
|
||||
# dont deep merge
|
||||
include "root" {
|
||||
path = find_in_parent_folders("root.hcl")
|
||||
}
|
||||
|
||||
terraform {
|
||||
source = "${get_repo_root()}/modules/node"
|
||||
}
|
||||
|
||||
inputs = {
|
||||
images = local.local_images
|
||||
networks = local.local_networks
|
||||
profiles = local.local_profiles
|
||||
storage_pools = local.local_storage_pools
|
||||
storage_volumes = local.local_storage_volumes
|
||||
node_name = local.node_name
|
||||
node_addr = local.config.node_addr
|
||||
node_port = local.config.node_port
|
||||
}
|
||||
|
||||
generate "provider" {
|
||||
path = "provider.tf"
|
||||
if_exists = "overwrite_terragrunt"
|
||||
contents = <<-EOF
|
||||
provider "incus" {
|
||||
generate_client_certificates = true
|
||||
accept_remote_certificate = true
|
||||
|
||||
remote {
|
||||
name = "${basename(get_terragrunt_dir())}"
|
||||
scheme = "https"
|
||||
address = "${local.config.node_addr}"
|
||||
port = "${local.config.node_port}"
|
||||
token = "${get_env("INCUS_TOKEN_${upper(local.node_name)}")}"
|
||||
default = true
|
||||
}
|
||||
}
|
||||
EOF
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user