diff --git a/scripts/install_xcpng.py b/scripts/install_xcpng.py
index 4e0d87745..fe55a02fd 100755
--- a/scripts/install_xcpng.py
+++ b/scripts/install_xcpng.py
@@ -4,7 +4,9 @@
import atexit
import logging
import os
+import random
import requests
+import string
import subprocess
import sys
import tempfile
@@ -47,6 +49,9 @@ def generate_answerfile(directory, installer, hostname_or_ip, action, hdd):
cmd = ['openssl', 'passwd', '-6', password]
res = subprocess.run(cmd, stdout=subprocess.PIPE)
encrypted_password = res.stdout.decode().strip()
+ hostname = "xcp-ng-" + "".join(
+ random.choice(string.ascii_lowercase) for i in range(5)
+ )
with open(f'{directory}/answerfile.xml', 'w') as answerfile:
if action == 'install':
answerfile.write(f"""
@@ -58,6 +63,7 @@ def generate_answerfile(directory, installer, hostname_or_ip, action, hdd):
Europe/Paris
+ {hostname}