2022-09-19 12:11:55 +00:00
|
|
|
from .base import BaseType
|
2022-09-18 16:07:59 +00:00
|
|
|
|
2022-11-22 09:33:09 +00:00
|
|
|
GATEWAY_NAME = 'Gateway'
|
|
|
|
|
2022-09-19 12:11:55 +00:00
|
|
|
|
|
|
|
class HostTypes(BaseType):
|
2022-09-18 16:07:59 +00:00
|
|
|
LINUX = 'linux', 'Linux'
|
|
|
|
WINDOWS = 'windows', 'Windows'
|
|
|
|
UNIX = 'unix', 'Unix'
|
2022-09-19 12:11:55 +00:00
|
|
|
OTHER_HOST = 'other', "Other"
|
2022-09-18 16:07:59 +00:00
|
|
|
|
|
|
|
@classmethod
|
2022-09-19 12:11:55 +00:00
|
|
|
def _get_base_constrains(cls) -> dict:
|
2022-09-18 16:07:59 +00:00
|
|
|
return {
|
2022-09-19 12:11:55 +00:00
|
|
|
'*': {
|
2022-09-21 11:03:06 +00:00
|
|
|
'charset_enabled': True,
|
2022-09-22 07:24:32 +00:00
|
|
|
'charset': 'utf-8', # default
|
2022-09-19 12:11:55 +00:00
|
|
|
'domain_enabled': True,
|
|
|
|
'su_enabled': True,
|
2022-09-22 07:24:32 +00:00
|
|
|
'su_methods': [
|
2022-09-22 08:39:41 +00:00
|
|
|
{'name': 'sudo su', 'id': 'sudo su'},
|
|
|
|
{'name': 'su -', 'id': 'su -'}
|
2022-09-22 07:24:32 +00:00
|
|
|
],
|
2022-09-18 16:07:59 +00:00
|
|
|
},
|
|
|
|
cls.WINDOWS: {
|
2022-09-19 12:11:55 +00:00
|
|
|
'su_enabled': False,
|
2022-09-18 16:07:59 +00:00
|
|
|
},
|
2022-09-19 12:11:55 +00:00
|
|
|
cls.OTHER_HOST: {
|
|
|
|
'su_enabled': False,
|
2022-09-18 16:07:59 +00:00
|
|
|
}
|
2022-09-19 12:11:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def _get_protocol_constrains(cls) -> dict:
|
|
|
|
return {
|
|
|
|
'*': {
|
2022-12-19 03:35:50 +00:00
|
|
|
'choices': ['ssh', 'telnet', 'vnc', 'rdp']
|
2022-10-14 08:33:24 +00:00
|
|
|
},
|
|
|
|
cls.WINDOWS: {
|
|
|
|
'choices': ['rdp', 'ssh', 'vnc']
|
2022-09-19 12:11:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def _get_automation_constrains(cls) -> dict:
|
|
|
|
return {
|
|
|
|
'*': {
|
2022-09-26 10:03:48 +00:00
|
|
|
'ansible_enabled': True,
|
|
|
|
'ansible_config': {
|
|
|
|
'ansible_connection': 'smart',
|
|
|
|
},
|
2022-09-19 12:11:55 +00:00
|
|
|
'ping_enabled': True,
|
|
|
|
'gather_facts_enabled': True,
|
|
|
|
'gather_accounts_enabled': True,
|
|
|
|
'verify_account_enabled': True,
|
2022-10-13 09:47:29 +00:00
|
|
|
'change_secret_enabled': True,
|
2023-01-16 11:02:09 +00:00
|
|
|
'push_account_enabled': True
|
2022-09-26 10:03:48 +00:00
|
|
|
},
|
|
|
|
cls.WINDOWS: {
|
|
|
|
'ansible_config': {
|
2022-10-13 09:47:29 +00:00
|
|
|
'ansible_shell_type': 'cmd',
|
2022-09-26 10:03:48 +00:00
|
|
|
'ansible_connection': 'ssh',
|
|
|
|
},
|
|
|
|
},
|
2022-09-19 12:11:55 +00:00
|
|
|
}
|
2022-09-22 07:24:32 +00:00
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def internal_platforms(cls):
|
|
|
|
return {
|
|
|
|
cls.LINUX: [
|
|
|
|
{'name': 'Linux'},
|
2023-01-18 07:27:09 +00:00
|
|
|
{
|
|
|
|
'name': GATEWAY_NAME,
|
|
|
|
'domain_enabled': False,
|
|
|
|
}
|
2022-09-22 07:24:32 +00:00
|
|
|
],
|
|
|
|
cls.UNIX: [
|
|
|
|
{'name': 'Unix'},
|
|
|
|
{'name': 'macOS'},
|
|
|
|
{'name': 'BSD'},
|
2023-01-16 11:02:09 +00:00
|
|
|
{'name': 'AIX'},
|
2022-09-22 07:24:32 +00:00
|
|
|
],
|
|
|
|
cls.WINDOWS: [
|
|
|
|
{'name': 'Windows'},
|
2022-10-25 04:57:34 +00:00
|
|
|
{
|
|
|
|
'name': 'Windows-TLS',
|
|
|
|
'protocols_setting': {
|
|
|
|
'rdp': {'security': 'tls'},
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
'name': 'Windows-RDP',
|
|
|
|
'protocols_setting': {
|
|
|
|
'rdp': {'security': 'rdp'},
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
'name': 'RemoteAppHost',
|
|
|
|
'_protocols': ['rdp', 'ssh'],
|
2022-12-19 03:35:50 +00:00
|
|
|
'protocols_setting': {
|
2022-10-25 04:57:34 +00:00
|
|
|
'ssh': {
|
|
|
|
'required': True
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-09-22 07:24:32 +00:00
|
|
|
],
|
|
|
|
cls.OTHER_HOST: []
|
|
|
|
}
|
2022-12-19 03:35:50 +00:00
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def get_community_types(cls) -> list:
|
|
|
|
return [
|
|
|
|
cls.LINUX, cls.UNIX, cls.WINDOWS, cls.OTHER_HOST
|
|
|
|
]
|