Browse Source

perf: deploy applet host

pull/9019/head
Eric 2 years ago
parent
commit
7560a5cd1f
  1. 15
      apps/terminal/automations/deploy_applet_host/__init__.py
  2. 6
      apps/terminal/automations/deploy_applet_host/playbook.yml

15
apps/terminal/automations/deploy_applet_host/__init__.py

@ -27,13 +27,19 @@ class DeployAppletHostManager:
def generate_playbook(self):
playbook_src = os.path.join(CURRENT_DIR, 'playbook.yml')
base_site_url = settings.BASE_SITE_URL
bootstrap_token = settings.BOOTSTRAP_TOKEN
host_id = str(self.deployment.host.id)
if not base_site_url:
base_site_url = "localhost:8080"
with open(playbook_src) as f:
plays = yaml.safe_load(f)
for play in plays:
play['vars'].update(self.deployment.host.deploy_options)
play['vars']['DownloadHost'] = settings.BASE_URL + '/download/'
play['vars']['CORE_HOST'] = settings.BASE_URL
play['vars']['BOOTSTRAP_TOKEN'] = settings.BOOSTRAP_TOKEN
play['vars']['DownloadHost'] = base_site_url + '/download/'
play['vars']['CORE_HOST'] = base_site_url
play['vars']['BOOTSTRAP_TOKEN'] = bootstrap_token
play['vars']['HOST_ID'] = host_id
play['vars']['HOST_NAME'] = self.deployment.host.name
playbook_dir = os.path.join(self.run_dir, 'playbook')
@ -70,6 +76,3 @@ class DeployAppletHostManager:
self.deployment.date_finished = timezone.now()
with safe_db_connection():
self.deployment.save()

6
apps/terminal/automations/deploy_applet_host/playbook.yml

@ -5,6 +5,7 @@
DownloadHost: https://demo.jumpserver.org/download
Initial: 0
HOST_NAME: test
HOST_ID: 00000000-0000-0000-0000-000000000000
CORE_HOST: https://demo.jumpserver.org
BOOTSTRAP_TOKEN: PleaseChangeMe
RDS_Licensing: true
@ -38,7 +39,7 @@
- name: Install JumpServer Remoteapp agent (jumpserver)
ansible.windows.win_package:
path: "{{ ansible_env.TEMP }}\\{{ TinkerInstaller }}"
args:
arguments:
- /VERYSILENT
- /SUPPRESSMSGBOXES
- /NORESTART
@ -154,7 +155,8 @@
- name: Generate component config
ansible.windows.win_shell:
"remoteapp-server config --core_host {{ CORE_HOST }} --token {{ BOOTSTRAP_TOKEN }} --host_id {{ HOST_ID }}"
"remoteapp-server config --hostname {{ HOST_NAME }} --core_host {{ CORE_HOST }}
--token {{ BOOTSTRAP_TOKEN }} --host_id {{ HOST_ID }}"
- name: Install remoteapp-server service
ansible.windows.win_shell:

Loading…
Cancel
Save