ConfigLMM 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +70 -0
- data/CNAME +1 -0
- data/Examples/.lmm.state.yaml +159 -0
- data/Examples/ConfigLMM.mm.yaml +32 -0
- data/Examples/Implemented.mm.yaml +252 -4
- data/Examples/SmallBusiness.mm.yaml +492 -0
- data/Plugins/Apps/Answer/answer.lmm.rb +165 -0
- data/Plugins/Apps/Answer/answer@.service +40 -0
- data/Plugins/Apps/ArchiSteamFarm/ArchiSteamFarm.conf.erb +0 -3
- data/Plugins/Apps/ArchiSteamFarm/ArchiSteamFarm.lmm.rb +0 -1
- data/Plugins/Apps/Authentik/Authentik-ProxyOutpost.container +20 -0
- data/Plugins/Apps/Authentik/Authentik-Server.container +7 -1
- data/Plugins/Apps/Authentik/Authentik-Worker.container +7 -1
- data/Plugins/Apps/Authentik/Authentik.conf.erb +18 -6
- data/Plugins/Apps/Authentik/Authentik.lmm.rb +232 -45
- data/Plugins/Apps/BookStack/BookStack.conf.erb +38 -0
- data/Plugins/Apps/BookStack/BookStack.container +20 -0
- data/Plugins/Apps/BookStack/BookStack.lmm.rb +91 -0
- data/Plugins/Apps/Cassandra/Cassandra.lmm.rb +9 -19
- data/Plugins/Apps/ClickHouse/ClickHouse.container +28 -0
- data/Plugins/Apps/ClickHouse/ClickHouse.lmm.rb +113 -0
- data/Plugins/Apps/ClickHouse/Config/listen.yaml +2 -0
- data/Plugins/Apps/ClickHouse/Config/logger.yaml +8 -0
- data/Plugins/Apps/ClickHouse/Config/zookeepers.yaml +5 -0
- data/Plugins/Apps/ClickHouse/Connection.rb +96 -0
- data/Plugins/Apps/Discourse/Discourse-Sidekiq.container +22 -0
- data/Plugins/Apps/Discourse/Discourse.conf.erb +38 -0
- data/Plugins/Apps/Discourse/Discourse.container +21 -0
- data/Plugins/Apps/Discourse/Discourse.lmm.rb +156 -0
- data/Plugins/Apps/Dovecot/Dovecot.lmm.rb +87 -52
- data/Plugins/Apps/ERPNext/ERPNext-Frontend.container +24 -0
- data/Plugins/Apps/ERPNext/ERPNext-Queue.container +22 -0
- data/Plugins/Apps/ERPNext/ERPNext-Scheduler.container +22 -0
- data/Plugins/Apps/ERPNext/ERPNext-Websocket.container +24 -0
- data/Plugins/Apps/ERPNext/ERPNext.container +23 -0
- data/Plugins/Apps/ERPNext/ERPNext.lmm.rb +204 -0
- data/Plugins/Apps/ERPNext/ERPNext.network +12 -0
- data/Plugins/Apps/ERPNext/sites/apps.json +10 -0
- data/Plugins/Apps/ERPNext/sites/apps.txt +3 -0
- data/Plugins/Apps/ERPNext/sites/common_site_config.json +11 -0
- data/Plugins/Apps/GitLab/GitLab.container +9 -2
- data/Plugins/Apps/GitLab/GitLab.lmm.rb +52 -33
- data/Plugins/Apps/Homepage/Homepage.conf.erb +86 -0
- data/Plugins/Apps/Homepage/Homepage.container +19 -0
- data/Plugins/Apps/Homepage/Homepage.lmm.rb +54 -0
- data/Plugins/Apps/IPFS/IPFS.conf.erb +0 -3
- data/Plugins/Apps/IPFS/IPFS.lmm.rb +0 -1
- data/Plugins/Apps/InfluxDB/InfluxDB.conf.erb +0 -3
- data/Plugins/Apps/InfluxDB/InfluxDB.lmm.rb +0 -1
- data/Plugins/Apps/Jackett/Jackett.conf.erb +0 -3
- data/Plugins/Apps/Jackett/Jackett.lmm.rb +0 -1
- data/Plugins/Apps/Jellyfin/Jellyfin.conf.erb +0 -3
- data/Plugins/Apps/Jellyfin/Jellyfin.lmm.rb +0 -1
- data/Plugins/Apps/LetsEncrypt/LetsEncrypt.lmm.rb +78 -0
- data/Plugins/Apps/LetsEncrypt/hooks/dovecot.sh +2 -0
- data/Plugins/Apps/LetsEncrypt/hooks/nginx.sh +2 -0
- data/Plugins/Apps/LetsEncrypt/hooks/postfix.sh +2 -0
- data/Plugins/Apps/LetsEncrypt/renew-certificates.service +7 -0
- data/Plugins/Apps/LetsEncrypt/renew-certificates.timer +12 -0
- data/Plugins/Apps/LetsEncrypt/rfc2136.ini +11 -0
- data/Plugins/Apps/LibreTranslate/LibreTranslate.container +21 -0
- data/Plugins/Apps/LibreTranslate/LibreTranslate.lmm.rb +34 -0
- data/Plugins/Apps/Lobsters/Containerfile +81 -0
- data/Plugins/Apps/Lobsters/Lobsters-Tasks.container +26 -0
- data/Plugins/Apps/Lobsters/Lobsters.conf.erb +99 -0
- data/Plugins/Apps/Lobsters/Lobsters.container +27 -0
- data/Plugins/Apps/Lobsters/Lobsters.lmm.rb +196 -0
- data/Plugins/Apps/Lobsters/crontab +3 -0
- data/Plugins/Apps/Lobsters/database.yml +26 -0
- data/Plugins/Apps/Lobsters/entrypoint.sh +30 -0
- data/Plugins/Apps/Lobsters/generateCredentials.rb +19 -0
- data/Plugins/Apps/Lobsters/lobsters-cron.sh +25 -0
- data/Plugins/Apps/Lobsters/lobsters-daily.sh +23 -0
- data/Plugins/Apps/Lobsters/puma.rb +49 -0
- data/Plugins/Apps/MariaDB/Connection.rb +55 -0
- data/Plugins/Apps/MariaDB/MariaDB.lmm.rb +122 -0
- data/Plugins/Apps/Mastodon/Mastodon-Sidekiq.container +22 -0
- data/Plugins/Apps/Mastodon/Mastodon-Streaming.container +20 -0
- data/Plugins/Apps/Mastodon/Mastodon.conf.erb +34 -45
- data/Plugins/Apps/Mastodon/Mastodon.container +28 -0
- data/Plugins/Apps/Mastodon/Mastodon.lmm.rb +240 -5
- data/Plugins/Apps/Mastodon/configlmm.rake +30 -0
- data/Plugins/Apps/Mastodon/entrypoint.sh +16 -0
- data/Plugins/Apps/Matrix/Element.container +19 -0
- data/Plugins/Apps/Matrix/Matrix.conf.erb +47 -9
- data/Plugins/Apps/Matrix/Matrix.lmm.rb +119 -5
- data/Plugins/Apps/Matrix/Synapse.container +22 -0
- data/Plugins/Apps/Matrix/config.json +50 -0
- data/Plugins/Apps/Matrix/homeserver.yaml +70 -0
- data/Plugins/Apps/Matrix/log.config +30 -0
- data/Plugins/Apps/Netdata/Netdata.conf.erb +0 -3
- data/Plugins/Apps/Netdata/Netdata.lmm.rb +0 -1
- data/Plugins/Apps/Nextcloud/Nextcloud.conf.erb +3 -4
- data/Plugins/Apps/Nextcloud/Nextcloud.lmm.rb +155 -48
- data/Plugins/Apps/Nextcloud/autoconfig.php +13 -0
- data/Plugins/Apps/Nextcloud/config.php +10 -1
- data/Plugins/Apps/Nextcloud/nextcloudcron.service +8 -0
- data/Plugins/Apps/Nextcloud/nextcloudcron.timer +10 -0
- data/Plugins/Apps/Nginx/Connection.rb +93 -0
- data/Plugins/Apps/Nginx/conf.d/configlmm.conf +54 -4
- data/Plugins/Apps/Nginx/conf.d/languages.conf +21 -0
- data/Plugins/Apps/Nginx/config-lmm/errors.conf +33 -22
- data/Plugins/Apps/Nginx/config-lmm/gateway-errors.conf +20 -0
- data/Plugins/Apps/Nginx/config-lmm/proxy.conf +6 -2
- data/Plugins/Apps/Nginx/main.conf.erb +7 -3
- data/Plugins/Apps/Nginx/nginx.conf +2 -2
- data/Plugins/Apps/Nginx/nginx.lmm.rb +103 -81
- data/Plugins/Apps/Nginx/proxy.conf.erb +24 -6
- data/Plugins/Apps/Odoo/Odoo.conf.erb +0 -3
- data/Plugins/Apps/Odoo/Odoo.container +7 -1
- data/Plugins/Apps/Odoo/Odoo.lmm.rb +4 -5
- data/Plugins/Apps/Ollama/Ollama.container +26 -0
- data/Plugins/Apps/Ollama/Ollama.lmm.rb +73 -0
- data/Plugins/Apps/OpenTelemetry/Config/config.yaml +704 -0
- data/Plugins/Apps/OpenTelemetry/OpenTelemetry.lmm.rb +154 -0
- data/Plugins/Apps/OpenVidu/Ingress.container +23 -0
- data/Plugins/Apps/{GitLab/GitLab.conf.erb → OpenVidu/OpenVidu.conf.erb} +8 -3
- data/Plugins/Apps/OpenVidu/OpenVidu.container +21 -0
- data/Plugins/Apps/OpenVidu/OpenVidu.lmm.rb +94 -0
- data/Plugins/Apps/OpenVidu/OpenViduCall.conf.erb +32 -0
- data/Plugins/Apps/OpenVidu/OpenViduCall.container +20 -0
- data/Plugins/Apps/OpenVidu/ingress.yaml +10 -0
- data/Plugins/Apps/OpenVidu/livekit.yaml +13 -0
- data/Plugins/Apps/PHP-FPM/Connection.rb +91 -0
- data/Plugins/Apps/PHP-FPM/PHP-FPM.lmm.rb +31 -4
- data/Plugins/Apps/Peppermint/Peppermint.conf.erb +2 -9
- data/Plugins/Apps/Peppermint/Peppermint.container +7 -1
- data/Plugins/Apps/Peppermint/Peppermint.lmm.rb +29 -33
- data/Plugins/Apps/Perplexica/Perplexica.container +25 -0
- data/Plugins/Apps/Perplexica/Perplexica.lmm.rb +92 -0
- data/Plugins/Apps/Perplexica/config.toml +26 -0
- data/Plugins/Apps/Podman/Connection.rb +24 -0
- data/Plugins/Apps/Podman/Podman.lmm.rb +80 -0
- data/Plugins/Apps/Podman/storage.conf +6 -0
- data/Plugins/Apps/Postfix/Postfix.lmm.rb +249 -145
- data/Plugins/Apps/PostgreSQL/Connection.rb +97 -0
- data/Plugins/Apps/PostgreSQL/PostgreSQL.lmm.rb +204 -99
- data/Plugins/Apps/Pterodactyl/Pterodactyl.conf.erb +0 -3
- data/Plugins/Apps/Pterodactyl/Pterodactyl.lmm.rb +0 -2
- data/Plugins/Apps/Pterodactyl/Wings.conf.erb +0 -3
- data/Plugins/Apps/RVM/RVM.lmm.rb +57 -0
- data/Plugins/Apps/Roundcube/Roundcube.conf.erb +72 -0
- data/Plugins/Apps/Roundcube/Roundcube.lmm.rb +141 -0
- data/Plugins/Apps/SSH/SSH.lmm.rb +9 -15
- data/Plugins/Apps/SearXNG/SearXNG.container +22 -0
- data/Plugins/Apps/SearXNG/SearXNG.lmm.rb +79 -0
- data/Plugins/Apps/SearXNG/limiter.toml +40 -0
- data/Plugins/Apps/SearXNG/settings.yml +2 -0
- data/Plugins/Apps/SigNoz/Config/alerts.yml +11 -0
- data/Plugins/Apps/SigNoz/Config/otel-collector-config.yaml +110 -0
- data/Plugins/Apps/SigNoz/Config/otel-collector-opamp-config.yaml +1 -0
- data/Plugins/Apps/SigNoz/Config/prometheus.yml +18 -0
- data/Plugins/Apps/SigNoz/SigNoz-Collector.container +23 -0
- data/Plugins/Apps/SigNoz/SigNoz-Migrator.container +17 -0
- data/Plugins/Apps/SigNoz/SigNoz.conf.erb +61 -0
- data/Plugins/Apps/SigNoz/SigNoz.container +26 -0
- data/Plugins/Apps/SigNoz/SigNoz.lmm.rb +319 -0
- data/Plugins/Apps/Solr/log4j2.xml +89 -0
- data/Plugins/Apps/Solr/solr.lmm.rb +82 -0
- data/Plugins/Apps/Sunshine/Sunshine.conf.erb +0 -3
- data/Plugins/Apps/Sunshine/Sunshine.lmm.rb +0 -1
- data/Plugins/Apps/Tunnel/tunnel.lmm.rb +59 -0
- data/Plugins/Apps/Tunnel/tunnelTCP.service +9 -0
- data/Plugins/Apps/Tunnel/tunnelTCP.socket +9 -0
- data/Plugins/Apps/Tunnel/tunnelUDP.service +9 -0
- data/Plugins/Apps/Tunnel/tunnelUDP.socket +9 -0
- data/Plugins/Apps/UVdesk/UVdesk.conf.erb +0 -3
- data/Plugins/Apps/Umami/Umami.container +19 -0
- data/Plugins/Apps/Umami/Umami.lmm.rb +108 -0
- data/Plugins/Apps/Valkey/Valkey.lmm.rb +64 -20
- data/Plugins/Apps/Vaultwarden/Vaultwarden.conf.erb +9 -6
- data/Plugins/Apps/Vaultwarden/Vaultwarden.container +7 -1
- data/Plugins/Apps/Vaultwarden/Vaultwarden.lmm.rb +67 -28
- data/Plugins/Apps/Wiki.js/Wiki.js.conf.erb +39 -0
- data/Plugins/Apps/Wiki.js/Wiki.js.container +20 -0
- data/Plugins/Apps/Wiki.js/Wiki.js.lmm.rb +55 -0
- data/Plugins/Apps/YaCy/YaCy.conf.erb +93 -0
- data/Plugins/Apps/YaCy/YaCy.container +21 -0
- data/Plugins/Apps/YaCy/YaCy.lmm.rb +160 -0
- data/Plugins/Apps/ZooKeeper/ZooKeeper.container +24 -0
- data/Plugins/Apps/ZooKeeper/ZooKeeper.lmm.rb +68 -0
- data/Plugins/Apps/bitmagnet/bitmagnet.conf.erb +0 -3
- data/Plugins/Apps/bitmagnet/bitmagnet.lmm.rb +0 -1
- data/Plugins/Apps/gollum/gollum.conf.erb +40 -4
- data/Plugins/Apps/gollum/gollum.container +10 -1
- data/Plugins/Apps/gollum/gollum.lmm.rb +56 -47
- data/Plugins/Apps/llama.cpp/llama.cpp.container +28 -0
- data/Plugins/Apps/llama.cpp/llama.cpp.lmm.rb +90 -0
- data/Plugins/Apps/vLLM/vLLM.container +32 -0
- data/Plugins/Apps/vLLM/vLLM.lmm.rb +89 -0
- data/Plugins/OS/General/Utils.lmm.rb +26 -0
- data/Plugins/OS/Linux/Connection.rb +472 -0
- data/Plugins/OS/Linux/Debian/preseed.cfg.erb +81 -0
- data/Plugins/OS/Linux/Distributions.yaml +32 -0
- data/Plugins/OS/Linux/Flavours.yaml +24 -0
- data/Plugins/OS/Linux/Grub/grub.cfg +10 -0
- data/Plugins/OS/Linux/HTTP.rb +32 -0
- data/Plugins/OS/Linux/Linux.lmm.rb +708 -174
- data/Plugins/OS/Linux/Packages.yaml +67 -3
- data/Plugins/OS/Linux/Proxmox/answer.toml.erb +30 -0
- data/Plugins/OS/Linux/Services.yaml +8 -0
- data/Plugins/OS/Linux/Shell.rb +70 -0
- data/Plugins/OS/Linux/Syslinux/default +8 -0
- data/Plugins/OS/Linux/WireGuard/WireGuard.lmm.rb +93 -40
- data/Plugins/OS/Linux/WireGuard/wg0.conf.erb +3 -0
- data/Plugins/OS/Linux/openSUSE/autoinst.xml.erb +29 -3
- data/Plugins/OS/Linux/systemd/systemd.lmm.rb +13 -11
- data/Plugins/OS/Routers/Aruba/ArubaInstant.lmm.rb +6 -5
- data/Plugins/Platforms/GitHub.lmm.rb +73 -28
- data/Plugins/Platforms/GoDaddy/GoDaddy.lmm.rb +10 -7
- data/Plugins/Platforms/Proxmox/Proxmox.lmm.rb +402 -0
- data/Plugins/Platforms/Proxmox/XTerm.rb +321 -0
- data/Plugins/Platforms/libvirt/libvirt.lmm.rb +41 -15
- data/Plugins/Platforms/porkbun.lmm.rb +12 -2
- data/Plugins/Platforms/porkbun_spec.rb +2 -2
- data/Plugins/Services/DNS/AmberBit.lmm.rb +1 -1
- data/Plugins/Services/DNS/ArubaItDNS.lmm.rb +1 -1
- data/Plugins/Services/DNS/NICLV.lmm.rb +1 -1
- data/Plugins/Services/DNS/PowerDNS.lmm.rb +130 -41
- data/Plugins/Services/DNS/tonic.lmm.rb +22 -12
- data/bootstrap.sh +41 -3
- data/lib/ConfigLMM/Framework/plugins/dns.rb +4 -3
- data/lib/ConfigLMM/Framework/plugins/linuxApp.rb +187 -144
- data/lib/ConfigLMM/Framework/plugins/nginxApp.rb +54 -6
- data/lib/ConfigLMM/Framework/plugins/plugin.rb +68 -140
- data/lib/ConfigLMM/Framework/plugins/store.rb +4 -4
- data/lib/ConfigLMM/Framework/variables.rb +75 -0
- data/lib/ConfigLMM/Framework.rb +1 -0
- data/lib/ConfigLMM/cli.rb +13 -5
- data/lib/ConfigLMM/commands/cleanup.rb +1 -0
- data/lib/ConfigLMM/commands/configsCommand.rb +38 -5
- data/lib/ConfigLMM/commands/diff.rb +33 -9
- data/lib/ConfigLMM/context.rb +22 -3
- data/lib/ConfigLMM/io/configList.rb +85 -7
- data/lib/ConfigLMM/io/connection.rb +143 -0
- data/lib/ConfigLMM/io/dhcp.rb +330 -0
- data/lib/ConfigLMM/io/http.rb +78 -0
- data/lib/ConfigLMM/io/local.rb +207 -0
- data/lib/ConfigLMM/io/pxe.rb +92 -0
- data/lib/ConfigLMM/io/ssh.rb +156 -0
- data/lib/ConfigLMM/io/tftp.rb +105 -0
- data/lib/ConfigLMM/io.rb +2 -0
- data/lib/ConfigLMM/secrets/envStore.rb +39 -0
- data/lib/ConfigLMM/secrets/fileStore.rb +43 -0
- data/lib/ConfigLMM/state.rb +12 -3
- data/lib/ConfigLMM/version.rb +2 -1
- data/lib/ConfigLMM.rb +1 -0
- data/{Examples → scripts}/configlmmAuth.sh +7 -5
- metadata +257 -9
@@ -0,0 +1,89 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
module ConfigLMM
|
4
|
+
module LMM
|
5
|
+
class VLLM < Framework::Plugin
|
6
|
+
|
7
|
+
USER = 'vllm'
|
8
|
+
HOME_DIR = '/var/lib/vllm'
|
9
|
+
PORT = 18050
|
10
|
+
|
11
|
+
CPU_IMAGE = 'public.ecr.aws/q9t5s3a7/vllm-cpu-release-repo:v0.8.4'
|
12
|
+
CUDA_IMAGE = 'docker.io/vllm/vllm-openai:latest'
|
13
|
+
ROCM_IMAGE = 'docker.io/rocm/vllm:instinct_main'
|
14
|
+
|
15
|
+
def actionVLLMDeploy(id, target, activeState, context, options)
|
16
|
+
#raise Framework::PluginProcessError.new('Model field must be set!') unless target['Model']
|
17
|
+
|
18
|
+
self.withConnection(target['Location'], target) do |connection|
|
19
|
+
Linux.withConnection(connection) do |linuxConnection|
|
20
|
+
Podman.ensurePresent(linuxConnection, options)
|
21
|
+
Podman.createUser(USER, HOME_DIR, 'vLLM', linuxConnection, options)
|
22
|
+
linuxConnection.withUserShell(USER) do |shell|
|
23
|
+
shell.createDirs(options, '~/.cache', '~/.triton')
|
24
|
+
end
|
25
|
+
|
26
|
+
path = Podman.containersPath(HOME_DIR)
|
27
|
+
|
28
|
+
linuxConnection.fileWrite("#{path}/vLLM.env", '', options)
|
29
|
+
|
30
|
+
linuxConnection.setUserGroup("#{path}/vLLM.env", USER, USER, options)
|
31
|
+
linuxConnection.setPrivate("#{path}/vLLM.env", options)
|
32
|
+
|
33
|
+
linuxConnection.upload(__dir__ + '/vLLM.container', path, options)
|
34
|
+
|
35
|
+
devices = linuxConnection.getGPUDevices(options)
|
36
|
+
groups = linuxConnection.getGPUGroups(devices, options)
|
37
|
+
linuxConnection.userAddGroups(USER, groups, options)
|
38
|
+
|
39
|
+
image = CPU_IMAGE
|
40
|
+
if devices.include?('/dev/kfd')
|
41
|
+
image = ROCM_IMAGE
|
42
|
+
elsif devices.include?('nvidia.com/gpu=all')
|
43
|
+
image = CUDA_IMAGE
|
44
|
+
end
|
45
|
+
linuxConnection.fileReplace("#{path}/vLLM.container", '\$IMAGE', image, options)
|
46
|
+
|
47
|
+
args = target['Args'].to_s
|
48
|
+
if target['Model']
|
49
|
+
args += ' --model ' + target['Model'].to_s
|
50
|
+
end
|
51
|
+
linuxConnection.fileReplace("#{path}/vLLM.container", '\$ARGS', args, options)
|
52
|
+
|
53
|
+
devicesString = ''
|
54
|
+
if !devices.empty?
|
55
|
+
devicesString = devices.map { |device| "AddDevice=#{device}" }.join('\n')
|
56
|
+
end
|
57
|
+
|
58
|
+
linuxConnection.fileReplace("#{path}/vLLM.container", '\$DEVICES', devicesString, { **options, escape: false })
|
59
|
+
|
60
|
+
linuxConnection.reloadUserServices(USER, options)
|
61
|
+
linuxConnection.restartUserService(USER, 'vLLM', options)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
def cleanup(configs, state, context, options)
|
67
|
+
cleanupType(:vLLM, configs, state, context, options) do |item, id, state, context, options, connection|
|
68
|
+
Linux.withConnection(connection) do |linuxConnection|
|
69
|
+
|
70
|
+
linuxConnection.stopUserService(USER, 'vLLM', options)
|
71
|
+
|
72
|
+
path = Podman.containersPath(HOME_DIR)
|
73
|
+
linuxConnection.rm(path + '/vLLM.container', options[:dry])
|
74
|
+
|
75
|
+
linuxConnection.reloadUserServices(USER, options)
|
76
|
+
|
77
|
+
state.item(id)['Status'] = State::STATUS_DELETED unless options[:dry]
|
78
|
+
|
79
|
+
if options[:destroy]
|
80
|
+
linuxConnection.deleteUserAndGroup(USER, options)
|
81
|
+
state.item(id)['Status'] = State::STATUS_DESTROYED unless options[:dry]
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
|
2
|
+
module ConfigLMM
|
3
|
+
module LMM
|
4
|
+
class Utils < Framework::Plugin
|
5
|
+
|
6
|
+
def actionFilesystemDeploy(id, target, activeState, context, options)
|
7
|
+
self.withConnection(target['Location'], target) do |connection|
|
8
|
+
Linux.withConnection(connection) do |linuxConnection|
|
9
|
+
if target['Directory']
|
10
|
+
linuxConnection.createDirs(options, target['Directory'])
|
11
|
+
end
|
12
|
+
if target['Directories']
|
13
|
+
linuxConnection.createDirs(options, *target['Directories'])
|
14
|
+
end
|
15
|
+
if target['Copy']
|
16
|
+
target['Copy'].each do |source, target|
|
17
|
+
linuxConnection.upload(source, target, options)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,472 @@
|
|
1
|
+
|
2
|
+
require_relative 'Shell'
|
3
|
+
require_relative 'HTTP'
|
4
|
+
|
5
|
+
require 'shellwords'
|
6
|
+
|
7
|
+
module ConfigLMM
|
8
|
+
module LMM
|
9
|
+
class LinuxConnection
|
10
|
+
|
11
|
+
attr_reader :connection
|
12
|
+
attr_reader :local
|
13
|
+
attr_reader :distroID
|
14
|
+
attr_reader :distributions
|
15
|
+
attr_reader :allServices
|
16
|
+
|
17
|
+
def initialize(connection)
|
18
|
+
@connection = connection
|
19
|
+
@local = connection.local
|
20
|
+
@distroID = self.class.distroID(@connection)
|
21
|
+
@distributions = YAML.load_file(__dir__ + '/Distributions.yaml')
|
22
|
+
@allServices = YAML.load_file(__dir__ + '/Services.yaml')
|
23
|
+
end
|
24
|
+
|
25
|
+
def prompt
|
26
|
+
@connection.prompt
|
27
|
+
end
|
28
|
+
|
29
|
+
def logger
|
30
|
+
@connection.logger
|
31
|
+
end
|
32
|
+
|
33
|
+
def distroInfo
|
34
|
+
raise Framework::PluginProcessError.new("Unknown Linux Distro: #{distroID}!") unless distributions.key?(distroID)
|
35
|
+
distributions[distroID]
|
36
|
+
end
|
37
|
+
|
38
|
+
def distroName
|
39
|
+
distroInfo['Name']
|
40
|
+
end
|
41
|
+
|
42
|
+
def distroVersion
|
43
|
+
@VersionId ||= connection.exec('cat /etc/os-release | grep "^VERSION_ID=" | cut -d "=" -f 2').strip.gsub('"', '')
|
44
|
+
@VersionId
|
45
|
+
end
|
46
|
+
|
47
|
+
def exec(*args)
|
48
|
+
connection.exec(*args)
|
49
|
+
end
|
50
|
+
|
51
|
+
def rm(*args)
|
52
|
+
connection.rm(*args)
|
53
|
+
end
|
54
|
+
|
55
|
+
def filePresent?(*args)
|
56
|
+
connection.filePresent?(*args)
|
57
|
+
end
|
58
|
+
|
59
|
+
def fileLink?(*args)
|
60
|
+
connection.fileLink?(*args)
|
61
|
+
end
|
62
|
+
|
63
|
+
def upload(*args)
|
64
|
+
connection.upload(*args)
|
65
|
+
end
|
66
|
+
|
67
|
+
def download(*args)
|
68
|
+
connection.download(*args)
|
69
|
+
end
|
70
|
+
|
71
|
+
def updateFile(*args, &block)
|
72
|
+
connection.updateFile(*args, &block)
|
73
|
+
end
|
74
|
+
|
75
|
+
def uploadFolder(folder, target, options = {})
|
76
|
+
createDirs(options, target + '/' + File.basename(folder))
|
77
|
+
connection.uploadFolder(folder, target, options)
|
78
|
+
end
|
79
|
+
|
80
|
+
def escapePath(path)
|
81
|
+
escaped = path.shellescape
|
82
|
+
escaped = escaped[1..] if escaped.start_with?('\~')
|
83
|
+
escaped
|
84
|
+
end
|
85
|
+
|
86
|
+
def ensureFile(file, options = {})
|
87
|
+
connection.exec("touch #{escapePath(file)}", false, options)
|
88
|
+
end
|
89
|
+
|
90
|
+
def fileContains?(file, content, options = {})
|
91
|
+
!connection.exec("grep #{content.shellescape} #{escapePath(file)}", true, options).strip.empty?
|
92
|
+
end
|
93
|
+
|
94
|
+
def fileRead(file, options = {})
|
95
|
+
connection.exec("cat #{escapePath(file)}", false, options)
|
96
|
+
end
|
97
|
+
|
98
|
+
def fileWrite(target, data, options = {})
|
99
|
+
hide = ''
|
100
|
+
hide = ' ' if options[:hide]
|
101
|
+
connection.exec("#{hide}echo #{data.shellescape} > #{escapePath(target)}", false, options)
|
102
|
+
end
|
103
|
+
|
104
|
+
def fileAppend(target, data, options = {})
|
105
|
+
hide = ''
|
106
|
+
hide = ' ' if options[:hide]
|
107
|
+
connection.exec("#{hide}echo #{data.shellescape} >> #{escapePath(target)}", false, options)
|
108
|
+
end
|
109
|
+
|
110
|
+
def fileMerge(target, file, options = {})
|
111
|
+
connection.exec("cat #{escapePath(file)} >> #{escapePath(target)}", false, options)
|
112
|
+
end
|
113
|
+
|
114
|
+
def fileReplace(target, placeholder, result, options = {})
|
115
|
+
hide = ''
|
116
|
+
hide = ' ' if options[:hide]
|
117
|
+
result = result.to_s.gsub('\\', '\\\\\\') if options[:escape] != false
|
118
|
+
pattern = "s|#{placeholder}|#{result.to_s.gsub('&', '\\\\&').gsub('|', '\\\\|')}|"
|
119
|
+
connection.exec("#{hide}sed -Ei #{pattern.shellescape} #{escapePath(target)}", false, options)
|
120
|
+
end
|
121
|
+
|
122
|
+
def setUserGroup(path, user, group = nil, options = {})
|
123
|
+
if group
|
124
|
+
connection.exec("chown -R #{user}:#{group} #{escapePath(path)}", false, options)
|
125
|
+
else
|
126
|
+
connection.exec("chown -R #{user} #{escapePath(path)}", false, options)
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
def setPrivate(path, options = {})
|
131
|
+
connection.exec("chmod 600 #{escapePath(path)}", false, options)
|
132
|
+
end
|
133
|
+
|
134
|
+
def makeAccessible(path, options = {})
|
135
|
+
connection.exec("chmod og+rX #{escapePath(path)}", false, options)
|
136
|
+
end
|
137
|
+
|
138
|
+
def makeExecutable(path, options = {})
|
139
|
+
connection.exec("chmod +x #{escapePath(path)}", false, options)
|
140
|
+
end
|
141
|
+
|
142
|
+
def createDirs(options, *paths)
|
143
|
+
paths = paths.map { |path| escapePath(path) }
|
144
|
+
connection.exec("mkdir -p #{paths.join(' ')}", false, options)
|
145
|
+
end
|
146
|
+
|
147
|
+
def http(url, options, headers = {}, method = 'GET', data = nil, cookieFile = nil)
|
148
|
+
cmd = "curl --no-progress-meter #{url.shellescape} -X #{method}"
|
149
|
+
if cookieFile
|
150
|
+
cmd += " --cookie #{cookieFile.shellescape} --cookie-jar #{cookieFile.shellescape}"
|
151
|
+
end
|
152
|
+
headers.each do |name, value|
|
153
|
+
cmd += " -H '#{name}: #{value}'"
|
154
|
+
end
|
155
|
+
if !data.nil?
|
156
|
+
cmd += " --data-raw #{data.shellescape}"
|
157
|
+
end
|
158
|
+
connection.exec(cmd, false, options)
|
159
|
+
end
|
160
|
+
|
161
|
+
def withHTTP(options)
|
162
|
+
http = HttpConnection.new(self, options)
|
163
|
+
result = yield(http)
|
164
|
+
result
|
165
|
+
ensure
|
166
|
+
http.cleanup
|
167
|
+
end
|
168
|
+
|
169
|
+
def withUserShell(user)
|
170
|
+
yield(LinuxShell.new(self, user))
|
171
|
+
end
|
172
|
+
|
173
|
+
def execDistroCommand(param, commandName, allowFailure = false, options = {})
|
174
|
+
command = distroInfo[commandName]
|
175
|
+
raise Framework::PluginProcessError.new('Invalid command!') unless command
|
176
|
+
command += ' ' + param.shellescape unless param.nil?
|
177
|
+
connection.exec(command, allowFailure, options)
|
178
|
+
end
|
179
|
+
|
180
|
+
def ensurePackage(name, options = {})
|
181
|
+
ensurePackages([name], options)
|
182
|
+
end
|
183
|
+
|
184
|
+
def ensurePackages(names, options = {})
|
185
|
+
reposPackages = Framework::LinuxApp.mapPackages(names, distroName)
|
186
|
+
|
187
|
+
repos = []
|
188
|
+
pkgs = []
|
189
|
+
githubPackages = []
|
190
|
+
|
191
|
+
reposPackages.each do |pkg|
|
192
|
+
if pkg.include?('|')
|
193
|
+
repoName, pkg = pkg.split('|')
|
194
|
+
if repoName == 'GitHub'
|
195
|
+
githubPackages << pkg
|
196
|
+
else
|
197
|
+
repos << repoName
|
198
|
+
pkgs << pkg
|
199
|
+
end
|
200
|
+
else
|
201
|
+
pkgs << pkg
|
202
|
+
end
|
203
|
+
end
|
204
|
+
repos.each do |repoName|
|
205
|
+
addRepo(repoName, options)
|
206
|
+
end
|
207
|
+
|
208
|
+
if !pkgs.empty?
|
209
|
+
command = distroInfo['InstallPackage'] + ' ' + pkgs.map { |pkg| pkg.shellescape }.join(' ')
|
210
|
+
connection.adminExec(command, false, options)
|
211
|
+
end
|
212
|
+
|
213
|
+
handleGitHubPackages(githubPackages, options) unless githubPackages.empty?
|
214
|
+
end
|
215
|
+
|
216
|
+
def handleGitHubPackages(githubPackages, options)
|
217
|
+
githubPackages.each do |pkg|
|
218
|
+
repo, name = pkg.split(':')
|
219
|
+
namePattern = name.gsub('.', '\\.').gsub('*', '.*')
|
220
|
+
releases = GitHub::getReleases(repo, logger, {}, options)
|
221
|
+
releases.each do |release|
|
222
|
+
break if installGitHubRelease(release, namePattern, options)
|
223
|
+
end
|
224
|
+
end
|
225
|
+
end
|
226
|
+
|
227
|
+
def installGitHubRelease(release, namePattern, options)
|
228
|
+
release['assets'].each do |asset|
|
229
|
+
if asset['name'].match?(namePattern)
|
230
|
+
if asset['name'].end_with?('.rpm')
|
231
|
+
installRPM(asset['name'], asset['browser_download_url'], options)
|
232
|
+
elsif asset['name'].end_with?('.deb')
|
233
|
+
installDeb(asset['name'], asset['browser_download_url'], options)
|
234
|
+
elsif !asset['name'].include?('.')
|
235
|
+
binaryName = asset['name'].gsub(/\-(linux|amd64|x64|bin)/, '')
|
236
|
+
connection.exec("curl --silent --location --output /tmp/#{binaryName} #{asset['browser_download_url']}", false, options)
|
237
|
+
connection.exec("chmod +rx /tmp/#{binaryName}", false, options)
|
238
|
+
connection.adminExec("mv /tmp/#{binaryName} /usr/local/bin/", false, options)
|
239
|
+
else
|
240
|
+
$stderr.puts(asset)
|
241
|
+
raise 'Not Implemented!'
|
242
|
+
end
|
243
|
+
return true
|
244
|
+
end
|
245
|
+
end
|
246
|
+
false
|
247
|
+
end
|
248
|
+
|
249
|
+
def installRPM(name, url, options)
|
250
|
+
command = "rpm -U #{url.shellescape}"
|
251
|
+
connection.adminExec(command, true, options)
|
252
|
+
end
|
253
|
+
|
254
|
+
def installDeb(name, url, options)
|
255
|
+
pkgName = name.split('_').first
|
256
|
+
command = "dpkg-query --status #{pkgName.shellescape} | grep Version: | cut -d ' ' -f 2"
|
257
|
+
version = connection.exec(command, false, { **options, 'dry' => false }).strip
|
258
|
+
if version.empty? || !name.include?(version)
|
259
|
+
command = "curl --silent --location --output /tmp/pkg.deb #{url.shellescape}"
|
260
|
+
connection.exec(command, false, options)
|
261
|
+
|
262
|
+
command = "dpkg --install /tmp/pkg.deb"
|
263
|
+
connection.adminExec(command, false, options)
|
264
|
+
|
265
|
+
connection.rm('/tmp/pkg.deb', options['dry'])
|
266
|
+
end
|
267
|
+
end
|
268
|
+
|
269
|
+
def removePackage(name, options = {})
|
270
|
+
reposPackages = Framework::LinuxApp.mapPackages([name], distroName)
|
271
|
+
|
272
|
+
pkgs = []
|
273
|
+
reposPackages.each do |pkg|
|
274
|
+
if pkg.include?('|')
|
275
|
+
repoName, pkg = pkg.split('|')
|
276
|
+
pkgs << pkg
|
277
|
+
else
|
278
|
+
pkgs << pkg
|
279
|
+
end
|
280
|
+
end
|
281
|
+
|
282
|
+
command = distroInfo['RemovePackage'] + ' ' + pkgs.map { |pkg| pkg.shellescape }.join(' ')
|
283
|
+
connection.adminExec(command, true, options)
|
284
|
+
end
|
285
|
+
|
286
|
+
def addRepo(name, options)
|
287
|
+
if distroName == Linux::SUSE_NAME
|
288
|
+
connection.exec("zypper addrepo https://download.opensuse.org/repositories/#{name}/#{distroVersion}/#{name}.repo", true, options)
|
289
|
+
connection.exec("zypper --gpg-auto-import-keys refresh", false, options)
|
290
|
+
else
|
291
|
+
raise 'Not Implemented!'
|
292
|
+
end
|
293
|
+
end
|
294
|
+
|
295
|
+
def hasBinaries?(names, options)
|
296
|
+
names = [names] unless names.is_a?(Array)
|
297
|
+
names.each do |name|
|
298
|
+
connection.exec("which #{name}", true, options) if options['dry']
|
299
|
+
result = connection.exec("which #{name}", true, { **options, 'dry' => false }).strip
|
300
|
+
return false if result.empty? || result.include?("no #{name}")
|
301
|
+
end
|
302
|
+
true
|
303
|
+
end
|
304
|
+
|
305
|
+
def ensureServiceAutoStart(name, options = {})
|
306
|
+
name = convertServiceName(name)
|
307
|
+
execDistroCommand(name, 'AutoStartService', false, options)
|
308
|
+
end
|
309
|
+
|
310
|
+
def startService(name, options = {})
|
311
|
+
name = convertServiceName(name)
|
312
|
+
execDistroCommand(name, 'StartService', false, options)
|
313
|
+
end
|
314
|
+
|
315
|
+
def restartService(name, options = {})
|
316
|
+
name = convertServiceName(name)
|
317
|
+
execDistroCommand(name, 'RestartService', false, options)
|
318
|
+
end
|
319
|
+
|
320
|
+
def reloadService(name, options = {})
|
321
|
+
name = convertServiceName(name)
|
322
|
+
execDistroCommand(name, 'ReloadService', false, options)
|
323
|
+
end
|
324
|
+
|
325
|
+
def stopService(name, options = {})
|
326
|
+
name = convertServiceName(name)
|
327
|
+
execDistroCommand(name, 'StopService', true, options)
|
328
|
+
end
|
329
|
+
|
330
|
+
def disableService(name, options = {})
|
331
|
+
name = convertServiceName(name)
|
332
|
+
execDistroCommand(name, 'DisableService', true, options)
|
333
|
+
end
|
334
|
+
|
335
|
+
def reloadServiceManager(options = {})
|
336
|
+
execDistroCommand(nil, 'ReloadServiceManager', false, options)
|
337
|
+
end
|
338
|
+
|
339
|
+
def deleteUserAndGroup(name, options = {})
|
340
|
+
execDistroCommand(name, 'DeleteUser', true, options)
|
341
|
+
execDistroCommand(name, 'DeleteGroup', true, options)
|
342
|
+
end
|
343
|
+
|
344
|
+
def userAddGroups(name, groups, options = {})
|
345
|
+
return if groups.empty?
|
346
|
+
groups = [groups] unless groups.is_a?(Array)
|
347
|
+
groups = groups.map { |group| group.shellescape }
|
348
|
+
|
349
|
+
command = distroInfo['ModifyUser']
|
350
|
+
connection.exec("#{command} --append --groups #{groups.join(' ')} #{name.shellescape}", false, options)
|
351
|
+
end
|
352
|
+
|
353
|
+
def firewallAddPort(portName, options = {})
|
354
|
+
command = 'firewall-cmd --quiet --permanent --add-port ' + portName.shellescape
|
355
|
+
connection.exec(command, true, options)
|
356
|
+
command = 'firewall-cmd --quiet --add-port ' + portName.shellescape
|
357
|
+
connection.exec(command, true, options)
|
358
|
+
end
|
359
|
+
|
360
|
+
def firewallRemovePort(portName, options = {})
|
361
|
+
command = 'firewall-cmd --quiet --permanent --remove-port ' + portName.shellescape
|
362
|
+
connection.exec(command, false, options)
|
363
|
+
command = 'firewall-cmd --quiet --remove-port ' + portName.shellescape
|
364
|
+
connection.exec(command, false, options)
|
365
|
+
end
|
366
|
+
|
367
|
+
def firewallAddService(serviceName, options = {})
|
368
|
+
command = 'firewall-cmd --permanent --add-service ' + serviceName.shellescape
|
369
|
+
connection.exec(command, true, options)
|
370
|
+
command = 'firewall-cmd --add-service ' + serviceName.shellescape
|
371
|
+
connection.exec(command, true, options)
|
372
|
+
end
|
373
|
+
|
374
|
+
def firewallRemoveService(serviceName, options = {})
|
375
|
+
command = 'firewall-cmd --permanent --remove-service ' + serviceName.shellescape
|
376
|
+
connection.exec(command, false, options)
|
377
|
+
command = 'firewall-cmd --remove-service ' + serviceName.shellescape
|
378
|
+
connection.exec(command, false, options)
|
379
|
+
end
|
380
|
+
|
381
|
+
def createServiceUser(user, homedir, userComment = '', options = {})
|
382
|
+
addUserCmd = "#{distroInfo['CreateServiceUser']} --home-dir #{homedir.shellescape} --create-home --comment #{userComment.shellescape} #{user.shellescape}"
|
383
|
+
result = connection.exec(addUserCmd, true, options)
|
384
|
+
if result.strip.start_with?('useradd:')
|
385
|
+
# Allow these
|
386
|
+
if !result.match?(/user '.*' already exists/) &&
|
387
|
+
!result.match?(/home directory .* already exists/)
|
388
|
+
raise Framework::PluginProcessError.new(result)
|
389
|
+
end
|
390
|
+
end
|
391
|
+
connection.exec("chmod o-rwx #{homedir.shellescape}", false, options)
|
392
|
+
end
|
393
|
+
|
394
|
+
def createSubuids(user, options, uids = '100000-165535', guids = '100000-165535')
|
395
|
+
connection.exec("#{distroInfo['ModifyUser']} --add-subuids #{uids} --add-subgids #{guids} #{user.shellescape}", options)
|
396
|
+
end
|
397
|
+
|
398
|
+
def enableLinger(user, options)
|
399
|
+
connection.exec("loginctl enable-linger #{user.shellescape}", options)
|
400
|
+
end
|
401
|
+
|
402
|
+
def reloadUserServices(user, options = {})
|
403
|
+
connection.exec("systemctl --user --machine=#{user}@ daemon-reload", false, options)
|
404
|
+
end
|
405
|
+
|
406
|
+
def stopUserService(user, service, options = {})
|
407
|
+
connection.exec("systemctl --user --machine=#{user}@ stop #{service}", true, options)
|
408
|
+
end
|
409
|
+
|
410
|
+
def restartUserService(user, service, options = {})
|
411
|
+
connection.exec("systemctl --user --machine=#{user}@ restart #{service}", false, options)
|
412
|
+
end
|
413
|
+
|
414
|
+
def convertServiceName(name)
|
415
|
+
if name.is_a?(Symbol)
|
416
|
+
raise "Distro '#{distroName}' not implemented!" unless allServices.key?(distroName)
|
417
|
+
serviceName = allServices[distroName][name.to_s]
|
418
|
+
name = serviceName || name.to_s
|
419
|
+
end
|
420
|
+
name
|
421
|
+
end
|
422
|
+
|
423
|
+
def getGPUDevices(options = {})
|
424
|
+
devices = []
|
425
|
+
['/dev/kfd', '/dev/dri'].each do |device|
|
426
|
+
devices << device if self.filePresent?(device, { **options, 'dry': false })
|
427
|
+
end
|
428
|
+
|
429
|
+
# TODO
|
430
|
+
#if isNVIDIA
|
431
|
+
# devices << 'nvidia.com/gpu=all'
|
432
|
+
#end
|
433
|
+
|
434
|
+
devices
|
435
|
+
end
|
436
|
+
|
437
|
+
def getGPUGroups(devices, options = {})
|
438
|
+
groups = []
|
439
|
+
devices.each do |device|
|
440
|
+
group = self.exec("stat --format='%G' #{device}", false, options).strip
|
441
|
+
groups << group unless group == 'root'
|
442
|
+
end
|
443
|
+
groups.uniq
|
444
|
+
end
|
445
|
+
|
446
|
+
def createWildecardCertificate(options = {})
|
447
|
+
dir = "/etc/letsencrypt/live/Wildcard/"
|
448
|
+
createDirs(options, dir)
|
449
|
+
# Need this temporarily before real certs are created
|
450
|
+
if !connection.filePresent?(dir + 'fullchain.pem', { **options, 'dry' => false })
|
451
|
+
connection.exec("openssl req -x509 -noenc -days 90 -newkey rsa:2048 -keyout #{dir}privkey.pem -out #{dir}fullchain.pem -subj '/C=US/O=ConfigLMM/CN=Wildcard'", false, options)
|
452
|
+
connection.exec("cp #{dir}fullchain.pem #{dir}chain.pem", false, options)
|
453
|
+
end
|
454
|
+
dir
|
455
|
+
end
|
456
|
+
|
457
|
+
def self.distroID(connection = nil)
|
458
|
+
cmd = 'cat /etc/os-release | grep "^ID=" | cut -d "=" -f 2'
|
459
|
+
if connection
|
460
|
+
if connection.is_a?(IO::Connection) || connection.is_a?(IO::Local)
|
461
|
+
connection.exec(cmd).strip.gsub('"', '')
|
462
|
+
else
|
463
|
+
connection.exec!(cmd).strip.gsub('"', '')
|
464
|
+
end
|
465
|
+
else
|
466
|
+
`#{cmd}`.strip.gsub('"', '')
|
467
|
+
end
|
468
|
+
end
|
469
|
+
|
470
|
+
end
|
471
|
+
end
|
472
|
+
end
|
@@ -0,0 +1,81 @@
|
|
1
|
+
#_preseed_V1
|
2
|
+
|
3
|
+
d-i debian-installer/locale string en_US
|
4
|
+
d-i keyboard-configuration/xkb-keymap select us
|
5
|
+
|
6
|
+
<% if config['DefaultNetwork']['Interface'] %>
|
7
|
+
d-i netcfg/choose_interface <%= config['DefaultNetwork']['Interface'] %>
|
8
|
+
<% end %>
|
9
|
+
|
10
|
+
<% if config['DefaultNetwork']['IP'] && config['DefaultNetwork']['IP'] != 'dhcp'%>
|
11
|
+
d-i netcfg/disable_autoconfig boolean true
|
12
|
+
d-i netcfg/dhcp_failed note
|
13
|
+
d-i netcfg/dhcp_options select Configure network manually
|
14
|
+
d-i netcfg/get_ipaddress string <%= config['DefaultNetwork']['IP'].split('/').first %>
|
15
|
+
d-i netcfg/get_netmask string <%= config['DefaultNetwork']['Subnet'] %>
|
16
|
+
d-i netcfg/confirm_static boolean true
|
17
|
+
<% end %>
|
18
|
+
|
19
|
+
<% if config['DefaultNetwork']['Gateway'] %>
|
20
|
+
d-i netcfg/get_gateway string <%= config['DefaultNetwork']['Gateway'] %>
|
21
|
+
<% end %>
|
22
|
+
|
23
|
+
<% if config['DefaultNetwork']['DNS'] %>
|
24
|
+
d-i netcfg/get_nameservers string <%= config['DefaultNetwork']['DNS'] %>
|
25
|
+
<% end %>
|
26
|
+
|
27
|
+
<% if config['DefaultNetwork']['VLAN'] %>
|
28
|
+
d-i netcfg/use_vlan boolean true
|
29
|
+
d-i netcfg/vlan_id string <%= config['DefaultNetwork']['VLAN'] %>
|
30
|
+
<% end %>
|
31
|
+
|
32
|
+
d-i netcfg/get_hostname string <%= Addressable::IDNA.to_ascii(config['Domain']) %>
|
33
|
+
|
34
|
+
d-i passwd/make-user boolean false
|
35
|
+
|
36
|
+
<% if config['Users'].to_h['root'].to_h['PasswordHash'] %>
|
37
|
+
d-i passwd/root-password-crypted password <%= config['Users']['root']['PasswordHash'] %>
|
38
|
+
<% elsif config['Users'].to_h['root'].to_h['Password'] %>
|
39
|
+
d-i passwd/root-password password <%= config['Users']['root']['Password'] %>
|
40
|
+
<% end %>
|
41
|
+
|
42
|
+
d-i time/zone string UTC
|
43
|
+
|
44
|
+
d-i partman-auto/method string regular
|
45
|
+
d-i partman-auto/choose_recipe select atomic
|
46
|
+
<% if !config['Disks'].empty? %>
|
47
|
+
d-i partman-auto/disk string <%= config['Disks'].join(' ') %>
|
48
|
+
<% end %>
|
49
|
+
<% if config['AutoPartition'] %>
|
50
|
+
d-i partman/choose_partition select finish
|
51
|
+
d-i partman/confirm_nooverwrite boolean true
|
52
|
+
<% end %>
|
53
|
+
|
54
|
+
d-i base-installer/install-recommends boolean false
|
55
|
+
d-i apt-setup/cdrom/set-first boolean false
|
56
|
+
d-i apt-setup/non-free-firmware boolean true
|
57
|
+
d-i apt-setup/non-free boolean true
|
58
|
+
d-i apt-setup/contrib boolean true
|
59
|
+
d-i apt-setup/use_mirror boolean true
|
60
|
+
d-i mirror/country string US
|
61
|
+
d-i mirror/http/mirror select deb.debian.org
|
62
|
+
d-i mirror/http/proxy string
|
63
|
+
|
64
|
+
d-i pkgsel/run_tasksel boolean false
|
65
|
+
|
66
|
+
<% if !config['Apps'].to_a.empty? %>
|
67
|
+
d-i pkgsel/include string <%= config['Apps'].map(&:downcase).join(' ') %>
|
68
|
+
<% end %>
|
69
|
+
|
70
|
+
d-i pkgsel/upgrade select full-upgrade
|
71
|
+
|
72
|
+
popularity-contest popularity-contest/participate boolean false
|
73
|
+
|
74
|
+
d-i grub-installer/only_debian boolean true
|
75
|
+
d-i grub-installer/bootdev string default
|
76
|
+
|
77
|
+
d-i finish-install/reboot_in_progress note
|
78
|
+
|
79
|
+
<% if !config['Users'].to_h['root'].to_h['AuthorizedKeys'].empty? %>
|
80
|
+
d-i preseed/late_command string in-target sh -c "echo '<%= config['Users']['root']['AuthorizedKeys'].first %>' > /root/.ssh/authorized_keys"
|
81
|
+
<% end %>
|