packer-plugin-ksyun

command module
v0.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 7, 2023 License: MPL-2.0 Imports: 7 Imported by: 0

README

Packer Builder for Kingsoft Cloud KEC And Bare Metal

This is a HashiCorp Packer plugin for creating Kingsoft Cloud KEC & BareMetal image.

Requirements

Build & Installation

Install from source:

Clone repository to $GOPATH/src/github.com/kingsoftcloud/packer-plugin-ksyun

$ mkdir -p $GOPATH/src/github.com/kingsoftcloud; 
$ cd $GOPATH/src/github.com/kingsoftcloud
$ git clone git@github.com:kingsoftcloud/packer-plugin-ksyun.git

Enter the provider directory and build the provider

$ cd $GOPATH/src/github.com/kingsoftcloud/packer-plugin-ksyun
$ make install
Install from HCL:
packer {
  required_plugins {
    ksyun = {
      version = ">= 0.0.10"
      source  = "github.com/kingsoftcloud/ksyun"
    }
  }
}
Install from release:
  • Download binaries from the releases page.
  • Install the plugin, or simply put it into the same directory with JSON templates.
  • Move the downloaded binary to ~/.packer.d/plugins/

Usage for Kec

Here is a sample template, which you can also find in the example/ directory

{
  "variables": {
    "access_key": "{{ env `KSYUN_ACCESS_KEY` }}",
    "secret_key": "{{ env `KSYUN_SECRET_KEY` }}"
  },
  "builders": [{
    "type":"ksyun-kec",
    "access_key":"{{user `access_key`}}",
    "secret_key":"{{user `secret_key`}}",
    "region":"cn-shanghai-2",
    "image_name":"packer_test",
    "source_image_id":"IMG-dd1f8324-1f27-46e0-ad6b-b41d8c8ff025",
    "instance_type":"N3.1B",
    "ssh_username":"root",
    "associate_public_ip_address": true
  }],
  "provisioners": [{
    "type": "shell",
    "inline": [
      "sleep 30",
      "yum install mysql -y"
    ]
  }]
}

Usage for Bare Metal

Here is a sample template, which you can also find in the example/ directory

{
  "variables": {
    "access_key": "{{ env `KSYUN_ACCESS_KEY` }}",
    "secret_key": "{{ env `KSYUN_SECRET_KEY` }}"
  },
  "builders": [{
    "type":"ksyun-epc",
    "access_key":"{{user `access_key`}}",
    "secret_key":"{{user `secret_key`}}",
    "region":"cn-beijing-6",
    "source_image_id":"eb8c0428-476e-49af-8ccb-9fad2455a54c",
    "host_type":"EC-I-III-II",
    "availability_zone":"cn-beijing-6c",
    "raid": "Raid1",
    "ssh_username":"root",
    "ssh_clear_authorized_keys": true,
    "associate_public_ip_address": true
  }],
  "provisioners": [{
    "type": "shell",
    "inline": [
      "sleep 30",
      "yum install mysql -y"
    ]
  }]
}

Enter the API user credentials in your terminal with the following commands. Replace the and with your user details.

export KSYUN_ACCESS_KEY=<AK>
export KSYUN_SECRET_KEY=<SK>

Then run Packer using the example template with the command underneath.

# use for kec
packer build example/ksyun.json
# use for bare metal
packer build example/ksyun_epc.json

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
epc
kec
The ksyun contains a packersdk.Builder implementation that builds ecs images for ksyun.
The ksyun contains a packersdk.Builder implementation that builds ecs images for ksyun.
datasource
kmi

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL