perf: update playbook.yml

pull/8997/head
吴小白 2022-10-26 19:25:34 +08:00 committed by 老广
parent 994a484adb
commit 85574b43ee
1 changed files with 130 additions and 46 deletions

View File

@ -1,56 +1,140 @@
--- ---
- hosts: windows - hosts: windows
vars: vars:
- DownloadHost: https://demo.jumpserver.org/download - DownloadHost: https://demo.jumpserver.org/download
- RDS_Licensing: enabled - RDS_Licensing: enabled
- RDS_LicenseServer: 127.0.0.1 - RDS_LicenseServer: 127.0.0.1
- RDS_LicensingMode: 4 - RDS_LicensingMode: 4
- RDS_fSingleSessionPerUser: 0 - RDS_fSingleSessionPerUser: 1
- RDS_MaxDisconnectionTime: 60000 - RDS_MaxDisconnectionTime: 60000
- RDS_RemoteAppLogoffTimeLimit: 0 - RDS_RemoteAppLogoffTimeLimit: 0
tasks: tasks:
- name: Install RDS-Licensing (RDS) - name: Install RDS-Licensing (RDS)
ansible.windows.win_feature: ansible.windows.win_feature:
name: RDS-Licensing name: RDS-Licensing
state: present state: present
include_management_tools: yes include_management_tools: yes
when: RDS_Licensing == "enabled" when: RDS_Licensing == "enabled"
- name: Install RDS-RD-Server (RDS)
ansible.windows.win_feature: - name: Install RDS-RD-Server (RDS)
name: RDS-RD-Server ansible.windows.win_feature:
state: present name: RDS-RD-Server
include_management_tools: yes state: present
register: win_feature include_management_tools: yes
- name: Reboot if installing RDS feature requires it register: rds_install
ansible.windows.win_reboot:
when: win_feature.reboot_required - name: Reboot if installing RDS feature requires it
- name: Set RDS LicenseServer (regedit) ansible.windows.win_reboot:
ansible.windows.win_regedit: post_reboot_delay: 10
path: HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services test_command: whoami
name: LicenseServers when: rds_install.reboot_required
data: "{{ RDS_LicenseServer }}"
type: string - name: Set RDS LicenseServer (regedit)
- name: Set RDS LicensingMode (regedit) ansible.windows.win_regedit:
ansible.windows.win_regedit: path: HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services
path: HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services name: LicenseServers
name: LicensingMode data: "{{ RDS_LicenseServer }}"
data: "{{ RDS_LicensingMode }}" type: string
type: dword
- name: Set RDS fSingleSessionPerUser (regedit) - name: Set RDS LicensingMode (regedit)
ansible.windows.win_regedit: ansible.windows.win_regedit:
path: HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services path: HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services
name: fSingleSessionPerUser name: LicensingMode
data: "{{ RDS_fSingleSessionPerUser }}" data: "{{ RDS_LicensingMode }}"
type: dword type: dword
- name: Set RDS MaxDisconnectionTime (regedit)
ansible.windows.win_regedit: - name: Set RDS fSingleSessionPerUser (regedit)
path: HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services ansible.windows.win_regedit:
name: MaxDisconnectionTime path: HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services
data: "{{ RDS_MaxDisconnectionTime }}" name: fSingleSessionPerUser
type: dword data: "{{ RDS_fSingleSessionPerUser }}"
when: RDS_MaxDisconnectionTime >= 60000 type: dword
- name: Set RDS RemoteAppLogoffTimeLimit (regedit)
ansible.windows.win_regedit: - name: Set RDS MaxDisconnectionTime (regedit)
path: HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services ansible.windows.win_regedit:
name: RemoteAppLogoffTimeLimit path: HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services
data: "{{ RDS_RemoteAppLogoffTime }}" name: MaxDisconnectionTime
data: "{{ RDS_MaxDisconnectionTime }}"
type: dword
when: RDS_MaxDisconnectionTime >= 60000
- name: Set RDS RemoteAppLogoffTimeLimit (regedit)
ansible.windows.win_regedit:
path: HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services
name: RemoteAppLogoffTimeLimit
data: "{{ RDS_RemoteAppLogoffTimeLimit }}"
type: dword
- name: Download Jmservisor (jumpserver)
ansible.windows.win_get_url:
url: "{{ DownloadHost }}/Jmservisor.msi"
dest: "{{ ansible_env.TEMP }}\\Jmservisor.msi"
- name: Install the Jmservisor (jumpserver)
ansible.windows.win_package:
path: "{{ ansible_env.TEMP }}\\Jmservisor.msi"
state: present
- name: Download python-3.10.8
ansible.windows.win_get_url:
url: "{{ DownloadHost }}/python-3.10.8-amd64.exe"
dest: "{{ ansible_env.TEMP }}\\python-3.10.8-amd64.exe"
- name: Install the python-3.10.8
ansible.windows.win_package:
path: "{{ ansible_env.TEMP }}\\python-3.10.8-amd64.exe"
product_id: '{371d0d73-d418-4ffe-b280-58c3e7987525}'
arguments:
- /quiet
- InstallAllUsers=1
- PrependPath=1
- Include_test=0
- Include_launcher=0
state: present
register: win_install_python
- name: Reboot if installing Python package requires it
ansible.windows.win_reboot:
when: win_install_python.reboot_required
- name: Download pip packages
ansible.windows.win_get_url:
url: "{{ DownloadHost }}/pip_packages_v0.0.1.zip"
dest: "{{ ansible_env.TEMP }}\\pip_packages_v0.0.1.zip"
- name: Unzip pip_packages
community.windows.win_unzip:
src: "{{ ansible_env.TEMP }}\\pip_packages_v0.0.1.zip"
dest: "{{ ansible_env.TEMP }}"
- name: Install python requirements offline
ansible.windows.win_shell: pip install -r "{{ ansible_env.TEMP }}\pip_packages_v0.0.1\requirements.txt" --no-index --find-links="{{ ansible_env.TEMP }}\pip_packages_v0.0.1"
- name: Download chromedriver (chrome)
ansible.windows.win_get_url:
url: "{{ DownloadHost }}/chromedriver_win32.106.zip"
dest: "{{ ansible_env.TEMP }}\\chromedriver_win32.106.zip"
- name: Unzip chromedriver (chrome)
community.windows.win_unzip:
src: "{{ ansible_env.TEMP }}\\chromedriver_win32.106.zip"
dest: C:\Program Files\JumpServer\drivers
- name: Set chromedriver on the global system path (chrome)
ansible.windows.win_path:
elements:
- 'C:\Program Files\JumpServer\drivers'
- name: Download chrome msi package (chrome)
ansible.windows.win_get_url:
url: "{{ DownloadHost }}/googlechromestandaloneenterprise64.msi"
dest: "{{ ansible_env.TEMP }}\\googlechromestandaloneenterprise64.msi"
- name: Install chrome (chrome)
ansible.windows.win_package:
path: "{{ ansible_env.TEMP }}\\googlechromestandaloneenterprise64.msi"
state: present
arguments:
- /quiet