We could add vendor data and put the ssh keys there:

https://cloudinit.readthedocs.io/en/latest/topics/vendordata.html


On 1/13/21 10:01 AM, Alexandre Derumier wrote:
Currently, we always regenerate sshkeys on any config change.

It should be done only before the first vm start, but currently can't known 
that.

So, this patch only do it when vm is running.

Signed-off-by: Alexandre Derumier<aderum...@odiso.com>
---
  PVE/QemuServer/Cloudinit.pm | 2 ++
  1 file changed, 2 insertions(+)

diff --git a/PVE/QemuServer/Cloudinit.pm b/PVE/QemuServer/Cloudinit.pm
index 52a4203..dd643c1 100644
--- a/PVE/QemuServer/Cloudinit.pm
+++ b/PVE/QemuServer/Cloudinit.pm
@@ -135,6 +135,8 @@ sub cloudinit_userdata {
            $content .= "  - $k\n";
        }
      }
+    $content .= "ssh_deletekeys: false\n" if 
PVE::QemuServer::check_running($vmid);
+
      $content .= "chpasswd:\n";
      $content .= "  expire: False\n";


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to