76 lines
3.0 KiB
Plaintext
76 lines
3.0 KiB
Plaintext
|
|
# Info: KCL core lib defaults schemas for provisioning (Provisioning)
|
||
|
|
# Author: JesusPerezLorenzo
|
||
|
|
# Release: 0.0.4
|
||
|
|
# Date: 15-12-2023
|
||
|
|
import regex
|
||
|
|
import .lib
|
||
|
|
|
||
|
|
schema ServerDefaults:
|
||
|
|
"""
|
||
|
|
Server Defaults settings
|
||
|
|
"""
|
||
|
|
lock: bool = False
|
||
|
|
# To use private network, IPs will be set in servers items
|
||
|
|
priv_cidr_block?: str
|
||
|
|
time_zone: str = "UTC"
|
||
|
|
|
||
|
|
#zone?: str
|
||
|
|
# Second to wait before check in for running state
|
||
|
|
running_wait: int = 10
|
||
|
|
# Total seconds to wait for running state before timeout
|
||
|
|
running_timeout: int = 200
|
||
|
|
|
||
|
|
# Specific AMIs can be used with their ID
|
||
|
|
# If 'storage_os: find' storage_os_find will be used to find one in zone (region)
|
||
|
|
# expected something like: "name=debian-12 | arch=x86_64" or "name: debian-12 | arch: x86_64" will be parsed to find latest available
|
||
|
|
storage_os_find: str = "name: debian-12 | arch: x86_64"
|
||
|
|
|
||
|
|
#storage_os?: str
|
||
|
|
#storage_os: ami-0eb11ab33f229b26c
|
||
|
|
# If not Storage size, Plan Storage size will be used
|
||
|
|
# storages is defined in Provider defaults
|
||
|
|
#storages?: [Storage]
|
||
|
|
# Add one or more SSH keys to the admin account. Accepted values are SSH public keys or filenames from
|
||
|
|
# where to read the keys.
|
||
|
|
# ssh public key to be included in /root/.ssh/authorized_keys
|
||
|
|
ssh_key_path?: str
|
||
|
|
# Public certificate must be created or imported as a key_name
|
||
|
|
# use: providers/aws/bin/on-ssh.sh (add -h to get info)
|
||
|
|
ssh_key_name?: str
|
||
|
|
# Use it to rewrite or update ssh_key
|
||
|
|
# ssh_key_mode: rewrite
|
||
|
|
# AWS do not use utility network, if no value it will not be set and utility IP will not be set
|
||
|
|
# public network, if no value it will not be set and public IP will not be set
|
||
|
|
network_utility_ipv4: bool = True
|
||
|
|
network_utility_ipv6: bool = False
|
||
|
|
network_public_ipv4?: bool = True
|
||
|
|
network_public_ipv6?: bool = False
|
||
|
|
network_public_ip?: str
|
||
|
|
#TODO settings for Elastic IPs or instace without pubic IP
|
||
|
|
# To use private network a VPC + Subnet + NetworkInfterface has to be created, IPs will be set in servers items
|
||
|
|
# In AWS this is only a name
|
||
|
|
network_private_name?: str
|
||
|
|
network_private_id?: str
|
||
|
|
primary_dns?: str
|
||
|
|
secondary_dns?: str
|
||
|
|
main_domain?: str
|
||
|
|
domains_search?: str
|
||
|
|
# Labels to describe the server in `key: value` format, multiple can be declared.
|
||
|
|
# Usage: env: dev
|
||
|
|
labels: str
|
||
|
|
# Main user (default Debian user is admin)
|
||
|
|
user: str
|
||
|
|
user_ssh_key_path?: str
|
||
|
|
user_home?: str = "/home/${user}"
|
||
|
|
user_ssh_port?: int = 22
|
||
|
|
# If is not empty it will add servers entries to /etc/hosts and $HOME/.ssh/config
|
||
|
|
fix_local_hosts: bool = True
|
||
|
|
installer_user?: str = "${user}"
|
||
|
|
scale?: lib.ScaleResource
|
||
|
|
|
||
|
|
check:
|
||
|
|
user == Undefined or len(user) > 0, "Check user value"
|
||
|
|
#len(ssh_key_path) > 0, "Check ssh_key_path"
|
||
|
|
priv_cidr_block == Undefined or regex.match(priv_cidr_block, "^(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}\/(?:3[0-2]|[0-2]?[0-9])$"), "'priv_cidr_block = ${priv_cidr_block}' check value definition"
|
||
|
|
|