From 4bf147a93fcc81bf0781417aa003dec04bfe0549 Mon Sep 17 00:00:00 2001 From: Eric Date: Thu, 3 Nov 2022 15:11:20 +0800 Subject: [PATCH] perf: add remote app installer --- .../deploy_applet_host/playbook.yml | 49 +++++++++++++++---- apps/terminal/const.py | 1 + 2 files changed, 40 insertions(+), 10 deletions(-) diff --git a/apps/terminal/automations/deploy_applet_host/playbook.yml b/apps/terminal/automations/deploy_applet_host/playbook.yml index 0c115e91a..b2c64f0cb 100644 --- a/apps/terminal/automations/deploy_applet_host/playbook.yml +++ b/apps/terminal/automations/deploy_applet_host/playbook.yml @@ -13,6 +13,7 @@ RDS_fSingleSessionPerUser: 1 RDS_MaxDisconnectionTime: 60000 RDS_RemoteAppLogoffTimeLimit: 0 + TinkerInstaller: JumpServer-Remoteapp_v0.0.1.exe tasks: - name: Install RDS-Licensing (RDS) @@ -29,16 +30,26 @@ include_management_tools: yes register: rds_install - - name: Download Jmservisor (jumpserver) + - name: Download JumpServer Remoteapp installer (jumpserver) ansible.windows.win_get_url: - url: "{{ DownloadHost }}/Jmservisor.msi" - dest: "{{ ansible_env.TEMP }}\\Jmservisor.msi" + url: "{{ DownloadHost }}/{{ TinkerInstaller }}" + dest: "{{ ansible_env.TEMP }}\\{{ TinkerInstaller }}" - - name: Install the Jmservisor (jumpserver) + - name: Install JumpServer Remoteapp agent (jumpserver) ansible.windows.win_package: - path: "{{ ansible_env.TEMP }}\\Jmservisor.msi" + path: "{{ ansible_env.TEMP }}\\{{ TinkerInstaller }}" + args: + - /VERYSILENT + - /SUPPRESSMSGBOXES + - /NORESTART state: present + - name: Set remote-server on the global system path (remote-server) + ansible.windows.win_path: + elements: + - '%USERPROFILE%\AppData\Local\Programs\JumpServer-Remoteapp\' + scope: user + - name: Download python-3.10.8 ansible.windows.win_get_url: url: "{{ DownloadHost }}/python-3.10.8-amd64.exe" @@ -116,12 +127,12 @@ - name: Download chromedriver (chrome) ansible.windows.win_get_url: - url: "{{ DownloadHost }}/chromedriver_win32.106.zip" - dest: "{{ ansible_env.TEMP }}\\chromedriver_win32.106.zip" + url: "{{ DownloadHost }}/chromedriver_win32.107.zip" + dest: "{{ ansible_env.TEMP }}\\chromedriver_win32.107.zip" - name: Unzip chromedriver (chrome) community.windows.win_unzip: - src: "{{ ansible_env.TEMP }}\\chromedriver_win32.106.zip" + src: "{{ ansible_env.TEMP }}\\chromedriver_win32.107.zip" dest: C:\Program Files\JumpServer\drivers - name: Set chromedriver on the global system path (chrome) @@ -142,8 +153,26 @@ - /quiet - name: Generate component config - ansible.windows.win_shell: > - echo "Todo: Set config" + ansible.windows.win_shell: + "remoteapp-server config --core_host {{ CORE_HOST }} --token {{ BOOTSTRAP_TOKEN }} --host_id {{ HOST_ID }}" + + - name: Install remoteapp-server service + ansible.windows.win_shell: + "remoteapp-server service install" + + - name: Start remoteapp-server service + ansible.windows.win_shell: + "remoteapp-server service start" + + - name: Wait Tinker api health + ansible.windows.win_uri: + url: http://localhost:6068/api/health/ + status_code: 200 + method: GET + register: _result + until: _result.status_code == 200 + retries: 30 + delay: 5 - name: Sync all remote applets ansible.windows.win_shell: > diff --git a/apps/terminal/const.py b/apps/terminal/const.py index 7289f3180..ef23030df 100644 --- a/apps/terminal/const.py +++ b/apps/terminal/const.py @@ -50,6 +50,7 @@ class TerminalTypeChoices(TextChoices): celery = 'celery', 'Celery' magnus = 'magnus', 'Magnus' razor = 'razor', 'Razor' + tinker = 'tinker', 'Tinker' @classmethod def types(cls):