feat: initialise barebones server

- manage incus servers init
This commit is contained in:
2025-04-06 23:41:32 +10:00
parent 83d0b31753
commit 56eb5d7cfd
4 changed files with 43 additions and 22 deletions
+23 -1
View File
@@ -1,9 +1,14 @@
class incus (
Array[String] $packages = [
Array[String] $packages = [
'incus',
'incus-tools',
'incus-client'
],
Boolean $cluster = false,
Boolean $init = true,
String $bridge = 'incusbr0',
Stdlib::Port $server_port = 8443,
Stdlib::IP::Address $server_addr = $facts['networking']['ip'],
) {
package { $packages:
@@ -32,4 +37,21 @@ class incus (
match => '^root:',
notify => Service['incus'],
}
if $init {
file {'/root/incus.preseed.yaml':
ensure => file,
owner => root,
group => root,
content => template('incus/join_preseed.yaml.erb')
}
exec { 'initiate_incus':
path => ['/bin', '/usr/bin', '/sbin', '/usr/sbin'],
command => 'cat /root/incus.preseed.yaml | incus admin init --preseed && touch /root/.incus_initialized',
refreshonly => true,
creates => '/root/.incus_initialized',
subscribe => File['/root/incus.preseed.yaml'],
}
}
}