diff --git a/apps/terminal/automations/deploy_applet_host/__init__.py b/apps/terminal/automations/deploy_applet_host/__init__.py index 164340098..449306a92 100644 --- a/apps/terminal/automations/deploy_applet_host/__init__.py +++ b/apps/terminal/automations/deploy_applet_host/__init__.py @@ -6,7 +6,7 @@ from django.conf import settings from django.utils import timezone from common.db.utils import safe_db_connection -from common.utils import get_logger +from common.utils import get_logger, random_string from ops.ansible import PlaybookRunner, JMSInventory from terminal.models import Applet, AppletHostDeployment @@ -58,13 +58,15 @@ class DeployAppletHostManager: download_host = download_host.rstrip("/") def handler(plays): + applet_host_name = self.deployment.host.name + hostname = '{}-{}'.format(applet_host_name, random_string(7)) for play in plays: play["vars"].update(options) play["vars"]["APPLET_DOWNLOAD_HOST"] = download_host play["vars"]["CORE_HOST"] = core_host play["vars"]["BOOTSTRAP_TOKEN"] = bootstrap_token play["vars"]["HOST_ID"] = host_id - play["vars"]["HOST_NAME"] = self.deployment.host.name + play["vars"]["HOST_NAME"] = hostname return plays return self._generate_playbook("playbook.yml", handler)