feat: initialise barebones server (#248)
- manage incus servers init Reviewed-on: https://git.query.consul/unkinben/puppet-prod/pulls/248
This commit is contained in:
parent
83d0b31753
commit
0e3dd4d7d0
@ -135,9 +135,10 @@ zfs::datasets:
|
|||||||
mountpoint: '/data/incus'
|
mountpoint: '/data/incus'
|
||||||
|
|
||||||
# manage incus
|
# manage incus
|
||||||
incus::cluster::members_lookup: true
|
incus::init: true
|
||||||
incus::cluster::members_role: roles::infra::incus::node
|
incus::bridge: br10
|
||||||
incus::cluster::master: prodnxsr0009
|
incus::server_port: 8443
|
||||||
|
incus::server_addr: "%{hiera('networking_loopback0_ip')}"
|
||||||
|
|
||||||
# add sysadmin to incus-admin group
|
# add sysadmin to incus-admin group
|
||||||
profiles::accounts::sysadmin::extra_groups:
|
profiles::accounts::sysadmin::extra_groups:
|
||||||
|
|||||||
@ -13,6 +13,6 @@ Facter.add(:incus) do
|
|||||||
next {} if incus_output.empty? # Return an empty fact if there's no output
|
next {} if incus_output.empty? # Return an empty fact if there's no output
|
||||||
|
|
||||||
# Parse the output as YAML and return it
|
# Parse the output as YAML and return it
|
||||||
YAML.safe_load(incus_output)
|
YAML.safe_load(incus_output, permitted_classes: [Symbol, Time, Date])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -4,6 +4,11 @@ class incus (
|
|||||||
'incus-tools',
|
'incus-tools',
|
||||||
'incus-client'
|
'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:
|
package { $packages:
|
||||||
@ -32,4 +37,21 @@ class incus (
|
|||||||
match => '^root:',
|
match => '^root:',
|
||||||
notify => Service['incus'],
|
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'],
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,20 +1,18 @@
|
|||||||
config: {}
|
config:
|
||||||
|
core.https_address: <%= @server_fqdn %>:<%= @server_port %>
|
||||||
networks: []
|
networks: []
|
||||||
storage_pools: []
|
storage_pools: []
|
||||||
profiles: []
|
storage_volumes: []
|
||||||
|
profiles:
|
||||||
|
- config: {}
|
||||||
|
description: ""
|
||||||
|
devices:
|
||||||
|
eth0:
|
||||||
|
name: eth0
|
||||||
|
nictype: bridged
|
||||||
|
parent: <%= @bridge %>
|
||||||
|
type: nic
|
||||||
|
name: default
|
||||||
|
project: default
|
||||||
projects: []
|
projects: []
|
||||||
cluster:
|
cluster: null
|
||||||
server_name: <%= @server_fqdn %>
|
|
||||||
enabled: true
|
|
||||||
member_config:
|
|
||||||
- entity: storage-pool
|
|
||||||
name: local
|
|
||||||
key: source
|
|
||||||
value: ""
|
|
||||||
description: '"source" property for storage pool "local"'
|
|
||||||
cluster_address: <%= @cluster_address %>:<%= @server_port %>
|
|
||||||
cluster_certificate: |
|
|
||||||
<%= @certificate %>
|
|
||||||
server_address: <%= @server_fqdn %>:<%= @server_port %>
|
|
||||||
cluster_token: <%= @cluster_token %>
|
|
||||||
cluster_certificate_path: ""
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user