pref: 添加 deploy playbook

pull/8991/head
ibuler 2 years ago
parent e327c97170
commit 99e4836311

File diff suppressed because it is too large Load Diff

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ab1c609cc4c83a223835be0eab2a5a5b9050c853b66ccd2b2fa480073c8fc763
size 103346
oid sha256:5d945fc6151d6f6354052a0a09706a52e7a2fa2f9e02254965cf26b134d78c3a
size 103377

File diff suppressed because it is too large Load Diff

@ -0,0 +1,30 @@
# Generated by Django 3.2.14 on 2022-10-26 09:07
from django.db import migrations, models
def update_builtin_org(apps, schema_editor):
org_model = apps.get_model('orgs', 'Organization')
org_model.objects.create(
id='00000000-0000-0000-0000-000000000004',
name='SYSTEM', builtin=True
)
# 更新 Default
org_model.objects.filter(name='DEFAULT').update(builtin=True)
class Migration(migrations.Migration):
dependencies = [
('orgs', '0013_alter_organization_options'),
]
operations = [
migrations.AddField(
model_name='organization',
name='builtin',
field=models.BooleanField(default=False, verbose_name='Builtin'),
),
migrations.RunPython(update_builtin_org),
]

@ -69,6 +69,7 @@ class Organization(OrgRoleMixin, models.Model):
id = models.UUIDField(default=uuid.uuid4, primary_key=True)
name = models.CharField(max_length=128, unique=True, verbose_name=_("Name"))
created_by = models.CharField(max_length=32, null=True, blank=True, verbose_name=_('Created by'))
builtin = models.BooleanField(default=False, verbose_name=_('Builtin'))
date_created = models.DateTimeField(auto_now_add=True, null=True, blank=True, verbose_name=_('Date created'))
comment = models.TextField(default='', blank=True, verbose_name=_('Comment'))
members = models.ManyToManyField(
@ -139,13 +140,13 @@ class Organization(OrgRoleMixin, models.Model):
@classmethod
def default(cls):
defaults = dict(id=cls.DEFAULT_ID, name=cls.DEFAULT_NAME)
obj, created = cls.objects.get_or_create(defaults=defaults, id=cls.DEFAULT_ID)
obj, created = cls.objects.get_or_create(defaults=defaults, id=cls.DEFAULT_ID, builtin=True)
return obj
@classmethod
def root(cls):
name = settings.GLOBAL_ORG_DISPLAY_NAME or cls.ROOT_NAME
return cls(id=cls.ROOT_ID, name=name)
return cls(id=cls.ROOT_ID, name=name, builtin=True)
def is_root(self):
return self.id == self.ROOT_ID

@ -4,6 +4,7 @@ import threading
from collections import defaultdict
from functools import partial
import django.db.utils
from django.dispatch import receiver
from django.conf import settings
from django.utils.functional import LazyObject
@ -45,7 +46,10 @@ def expire_orgs_mapping_for_memory(org_id):
def subscribe_orgs_mapping_expire(sender, **kwargs):
logger.debug("Start subscribe for expire orgs mapping from memory")
if settings.DEBUG:
set_to_default_org()
try:
set_to_default_org()
except django.db.utils.OperationalError:
pass
def keep_subscribe_org_mapping():
orgs_mapping_for_memory_pub_sub.subscribe(

@ -0,0 +1,56 @@
---
- hosts: windows
vars:
- DownloadHost: https://demo.jumpserver.org/download
- RDS_Licensing: enabled
- RDS_LicenseServer: 127.0.0.1
- RDS_LicensingMode: 4
- RDS_fSingleSessionPerUser: 0
- RDS_MaxDisconnectionTime: 60000
- RDS_RemoteAppLogoffTimeLimit: 0
tasks:
- name: Install RDS-Licensing (RDS)
ansible.windows.win_feature:
name: RDS-Licensing
state: present
include_management_tools: yes
when: RDS_Licensing == "enabled"
- name: Install RDS-RD-Server (RDS)
ansible.windows.win_feature:
name: RDS-RD-Server
state: present
include_management_tools: yes
register: win_feature
- name: Reboot if installing RDS feature requires it
ansible.windows.win_reboot:
when: win_feature.reboot_required
- name: Set RDS LicenseServer (regedit)
ansible.windows.win_regedit:
path: HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services
name: LicenseServers
data: "{{ RDS_LicenseServer }}"
type: string
- name: Set RDS LicensingMode (regedit)
ansible.windows.win_regedit:
path: HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services
name: LicensingMode
data: "{{ RDS_LicensingMode }}"
type: dword
- name: Set RDS fSingleSessionPerUser (regedit)
ansible.windows.win_regedit:
path: HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services
name: fSingleSessionPerUser
data: "{{ RDS_fSingleSessionPerUser }}"
type: dword
- name: Set RDS MaxDisconnectionTime (regedit)
ansible.windows.win_regedit:
path: HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services
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_RemoteAppLogoffTime }}"

@ -0,0 +1,26 @@
# Generated by Django 3.2.14 on 2022-10-26 08:31
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('terminal', '0054_auto_20221024_1452'),
]
operations = [
migrations.RemoveField(
model_name='applet',
name='vcs_type',
),
migrations.RemoveField(
model_name='applet',
name='vcs_url',
),
migrations.AddField(
model_name='applet',
name='is_active',
field=models.BooleanField(default=True, verbose_name='Is active'),
),
]

@ -27,8 +27,7 @@ class Applet(JMSBaseModel):
version = models.CharField(max_length=16, verbose_name=_('Version'))
author = models.CharField(max_length=128, verbose_name=_('Author'))
type = models.CharField(max_length=16, verbose_name=_('Type'), default='general', choices=Type.choices)
vcs_type = models.CharField(max_length=16, verbose_name=_('VCS type'), null=True)
vcs_url = models.CharField(max_length=256, verbose_name=_('URL'), null=True)
is_active = models.BooleanField(default=True, verbose_name=_('Is active'))
protocols = models.JSONField(default=list, verbose_name=_('Protocol'))
tags = models.JSONField(default=list, verbose_name=_('Tags'))
comment = models.TextField(default='', blank=True, verbose_name=_('Comment'))

Loading…
Cancel
Save