跳转到主要内容

SaltStack云模块,用于管理Kamatera计算资源

项目描述

Salt Cloud Kamatera模块

安装

  • 安装Salt(版本2019.2.0或更高版本)
  • 使用与Salt安装相同的Python解释器安装模块
    • pip install salt-cloud-module-kamatera

使用

请参阅Salt Cloud文档,以了解Salt和Salt Cloud的一般工作原理。

配置

使用Salt管理Kamatera需要API密钥和密钥,您可以通过访问Kamatera控制台并在API密钥下添加新密钥来获取。在配置中使用创建的密钥ID和密钥。

# Note: This example is for /etc/salt/cloud.providers or any file in the
# /etc/salt/cloud.providers.d/ directory.

my-kamatera-config:
  driver: kamatera
  api_client_id: xxxxxxxxxxxxx
  api_secret: yyyyyyyyyyyyyyyyyyyyyy
  minion:
    master: saltmaster.example.com

服务器选项

位置

# salt-cloud --list-locations my-kamatera-config
my-kamatera-config:
    ----------
    kamatera:
        ----------
        AS:
            Hong Kong, China (Asia)
        CA-TR:
            Toronto, Canada (North America)
        EU:
            Amsterdam, The Netherlands (Europe)
...SNIP...

CPU类型

# salt-cloud --location=EU --list-sizes my-kamatera-config
my-kamatera-config:
    ----------
    kamatera:
        ----------
        A:
            ----------
            cpuCores:
                [1, 2, 4, 6, 8, 12, 16, 20, 24, 28, 32]
            description:
                Server CPUs are assigned to a non-dedicated physical CPU thread with no resources guaranteed.
            name:
                Type A - Availability
            ramMB:
                [256, 512, 1024, 2048, 3072, 4096, 6144, 8192, 10240, 12288, 16384, 24576, 32768, 49152, 65536, 98304, 131072]
        B:
            ----------
            cpuCores:
                [1, 2, 4, 6, 8, 12, 16, 20, 24, 28, 32, 36, 40, 48, 56, 64, 72, 88, 104]
...SNIP...

其他服务器选项

# salt-cloud --location=EU -f avail_server_options my-kamatera-config
my-kamatera-config:
    ----------
    kamatera:
        ----------
        A:
            ----------
            cpuCores:
                [1, 2, 4, 6, 8, 12, 16, 20, 24, 28, 32]
            description:
                Server CPUs are assigned to a non-dedicated physical CPU thread with no resources guaranteed.
            name:
                Type A - Availability
            ramMB:
                [256, 512, 1024, 2048, 3072, 4096, 6144, 8192, 10240, 12288, 16384, 24576, 32768, 49152, 65536, 98304, 131072]
        B:
            ----------
            cpuCores:
                [1, 2, 4, 6, 8, 12, 16, 20, 24, 28, 32, 36, 40, 48, 56, 64, 72, 88, 104]
...SNIP...

镜像

# salt-cloud --location=EU --list-images my-kamatera-config
my-kamatera-config:
    ----------
    kamatera:
        ----------
        EU:6000C2901a61dff371f4d1d34bd9548b:
            Ubuntu Server version 16.04 LTS (xenial) 32-bit
        EU:6000C29040fd67b51a229d7e641fba22:
            Ubuntu Server version 18.04 LTS (bionic) 64-bit.
            Optimized for best performance and with minimal OS services (OS use only 80MB RAM).
        EU:6000C2904fc6d8295d2b6d9687ed955e:
            Ubuntu Server version 18.04 LTS (bionic) 64-bit,
...SNIP...

创建服务器

/etc/salt/cloud.profiles/etc/salt/cloud.profiles.d/目录下设置云配置文件

my-kamatera-profile:
  size: "my-size"  # this is meaningless, required due to limitations in Salt Cloud
  provider: my-kamatera-config
  # salt-cloud --list-locations my-kamatera-config
  location: EU
  # salt-cloud --location EU --list-sizes my-kamatera-config
  cpu_type: B
  cpu_cores: 2
  ram_mb: 2048
  # primary disk size
  # salt-cloud --location EU -f avail_server_options my-kamatera-config
  disk_size_gb: 50
  # up to 3 additional disks
  extra_disk_sizes_gb:
    - 100
    - 200
  # hourly / monthly
  billing_cycle: monthly
  # traffic package is only relevant for monthly billing cycle
  # salt-cloud --location EU -f avail_server_options my-kamatera-config
  monthly_traffic_package: t5000
  # salt-cloud --location EU --list-images my-kamatera-config
  image: EU:6000C29a5a7220dcf84716e7bba74215
  # up to 4 network interfaces can be attached
  # network name 'wan' provides a public IP
  # you can add additional private networks in the Kamatera web-ui
  networks:
    - name: wan
      ip: auto
    # - name: my-lan-id
    #   ip: auto
  # whether to enable daily backups for the created server
  daily_backup: false
  # whether to provide managed support service
  managed: false

创建服务器

salt-cloud -p my-kamatera-profile my-server

在服务器上执行salt命令(需要Salt master +正确配置的网络)

salt my-server test.version

项目详情


下载文件

下载适合您的平台文件。如果您不确定要选择哪个,请了解更多关于安装包的信息。

源代码分发

salt_cloud_module_kamatera-0.0.3.tar.gz (8.4 KB 查看哈希

上传时间:

构建分发

salt_cloud_module_kamatera-0.0.3-py3-none-any.whl (10.2 kB 查看哈希值)

上传时间 Python 3

支持者