1
0
mirror of https://github.com/rancher/os.git synced 2025-09-15 22:49:08 +00:00

Initial cloud-init support for ProxmoxVE

This commit is contained in:
etrexel
2019-12-19 00:15:47 -08:00
committed by niusmallnan
parent 27d4dd2b8b
commit 8ad6b10446
3 changed files with 203 additions and 0 deletions

View File

@@ -36,6 +36,14 @@ func CloudInit(cfg *config.CloudConfig) (*config.CloudConfig, error) {
cfg.Rancher.CloudInit.Datasources = append([]string{"exoscale"}, cfg.Rancher.CloudInit.Datasources...)
}
proxmox, err := onlyProxmox()
if err != nil {
log.Error(err)
}
if proxmox {
cfg.Rancher.CloudInit.Datasources = append([]string{"proxmox"}, cfg.Rancher.CloutInit.Datasources...)
}
if len(cfg.Rancher.CloudInit.Datasources) == 0 {
log.Info("No specific datasources, ignore cloudinit")
return cfg, nil
@@ -151,3 +159,12 @@ func onlyExoscale() (bool, error) {
return strings.HasPrefix(string(f), "Exoscale"), nil
}
func onlyProxmox() (bool, error) {
f, err := ioutil.ReadFile("/sys/class/dmi/id/product_name")
if err != nil {
return false, err
}
return strings.Contains(string(f), "Proxmox"), nil
}