All Projects → sacloud → Vagrant Sakura

sacloud / Vagrant Sakura

Licence: mit
Use Vagrant to manage Sakura Cloud instances.

Programming Languages

ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to Vagrant Sakura

Reprozip
ReproZip is a tool that simplifies the process of creating reproducible experiments from command-line executions, a frequently-used common denominator in computational science.
Stars: ✭ 231 (+266.67%)
Mutual labels:  hacktoberfest, vagrant
Molecule Vagrant
Molecule Vangrant Driver
Stars: ✭ 69 (+9.52%)
Mutual labels:  hacktoberfest, vagrant
Malboxes
Builds malware analysis Windows VMs so that you don't have to.
Stars: ✭ 900 (+1328.57%)
Mutual labels:  hacktoberfest, vagrant
Jenkins Infra
Jenkins main control repo for R10k and our Puppet Enterprise managed infrastructure
Stars: ✭ 76 (+20.63%)
Mutual labels:  hacktoberfest, vagrant
Vagrant
Vagrant is a tool for building and distributing development environments.
Stars: ✭ 23,108 (+36579.37%)
Mutual labels:  hacktoberfest, vagrant
Phansible
Phansible - generate Vagrant + Ansible dev environments for PHP
Stars: ✭ 633 (+904.76%)
Mutual labels:  hacktoberfest, vagrant
Magma
Platform for building access networks and modular network services
Stars: ✭ 913 (+1349.21%)
Mutual labels:  hacktoberfest, vagrant
Graphql To Sparql.js
Converts GraphQL queries to SPARQL queries
Stars: ✭ 62 (-1.59%)
Mutual labels:  hacktoberfest
Prolens
👓 Profunctor based lightweight implementation of Lenses
Stars: ✭ 63 (+0%)
Mutual labels:  hacktoberfest
Nekobin
Elegant and open-source pastebin service
Stars: ✭ 61 (-3.17%)
Mutual labels:  hacktoberfest
Ascemu
Official AscEmu repo... a never ending place to work. With cutting edge technologies XD
Stars: ✭ 61 (-3.17%)
Mutual labels:  hacktoberfest
Fantasy Football Metrics Weekly Report
Command line application to create weekly reports (containing stats, metrics, and rankings) for Fantasy Football leagues on the following platforms: Yahoo, Fleaflicker, Sleeper, ESPN.
Stars: ✭ 62 (-1.59%)
Mutual labels:  hacktoberfest
Coursify Hacktoberfest
A curated list of best free learning resources on the planet, made specifically for first time hackers!
Stars: ✭ 63 (+0%)
Mutual labels:  hacktoberfest
Gaseous Giganticus
This program procedurally generates gas giant cubemap textures for the game Space Nerds In Space. https://www.patreon.com/smcameron
Stars: ✭ 62 (-1.59%)
Mutual labels:  hacktoberfest
Quill Delta Parser
A PHP library to parse and render Quill WYSIWYG Deltas into HTML - Flexibel and extendible for custom elements.
Stars: ✭ 63 (+0%)
Mutual labels:  hacktoberfest
Digitalocean Manager
iOS App to Manage and View your Virtual Server horsted by DigitalOcean
Stars: ✭ 61 (-3.17%)
Mutual labels:  hacktoberfest
Teammates
This is the project website for the TEAMMATES feedback management tool for education
Stars: ✭ 1,121 (+1679.37%)
Mutual labels:  hacktoberfest
Generator Jhipster Micronaut
Stars: ✭ 63 (+0%)
Mutual labels:  hacktoberfest
Vagrant Ova Plugin
Vagrant plugin that export a box from vbox to vmwware
Stars: ✭ 62 (-1.59%)
Mutual labels:  vagrant
Whisper
Whisper is a file-based time-series database format for Graphite.
Stars: ✭ 1,121 (+1679.37%)
Mutual labels:  hacktoberfest

Vagrant Sakura Provider

Gem Version Build Status Slack

この gem は Vagrantさくらのクラウド上のサーバを操作する 機能を追加する provider です。

このリポジトリはtsahara/vagrant-sakuraから移行されました。

機能 / 制限

  • さくらのクラウド上にサーバを作成できます。
  • サーバに SSH ログインできます。
  • サーバを停止/再開(オフ/オン)できます。
  • Chef をはじめとする provisioner が動きます。

なお Chef を利用する場合は vagrant-omnibus プラグインを使ってサーバ上に Chef をインストールしてください。

インストール

通常の Vagrant 1.1+ 以降のプラグインの導入方法でインストールできます。 インストール後は sakura プロバイダを指定して vagrant up してください。 以下に例を示します:

$ vagrant plugin install vagrant-sakura
...
$ vagrant up --provider=sakura
...

なお実行前にさくらのクラウド用の Vagrant box を取得しておく必要があります。

かんたんな使い方

プラグインを(先述の通りに)インストールしたら、てっとり早く始めるためには ダミーのさくらのクラウド用 box を使い、詳細は config.vm.provider で 指定します。 まずはじめに、ダミーの box を好きな名前で追加してください:

$ vagrant box add dummy https://github.com/sacloud/vagrant-sakura/raw/master/dummy.box
...

次に、以下のような Vagrantfile を作成し、必要な情報を埋めてください。 なお、以下の Vagrantfile は Vagrant 付属の "insecure key" でログインできる サーバを作成します。実用する際は次節の「SSH 鍵の指定方法」を参考に安全な SSH 鍵を設定してください。

Vagrant.configure("2") do |config|
  config.vm.box = "dummy"
  config.ssh.username = "ubuntu"

  config.vm.provider :sakura do |sakura|
    sakura.access_token = '<YOUR ACCESS TOKEN>'
    sakura.access_token_secret = '<YOUR ACCESS TOKEN SECRET>'
    sakura.use_insecure_key = true
  end
end

そして vagrant up --provider=sakura を実行してください。

サーバのディスクソース(OS)は sakura.disk_source_archive またはsakura.os_typeで指定します。
デフォルトではsakura.os_type="ubuntu"となっています。

注: ディスクソースに指定するOSに応じてconfig.ssh.usernameを適切に指定する必要があります。
詳細はos_typeの説明を参照してください。

APIキーの指定

さくらのクラウド API を利用するための APIキー(トークン/シークレット/ゾーン)は 以下の3通りの方法で指定できます。

  1. Vagrantfileに直接記載
  2. さくらのクラウド CLI Usacloudの設定ファイル
  3. 環境変数

複数指定されている場合はより上に記載されているものが優先されます。

1. Vagrantfileに直接記載

以下のようにVagrantfileに直接記載する方法です。

  config.vm.provider :sakura do |sakura|
    sakura.access_token = '<YOUR ACCESS TOKEN>'
    sakura.access_token_secret = '<YOUR ACCESS TOKEN SECRET>'
    sakura.zone_id = '< is1a / is1b / tk1a >'
    
    # ...
  end

2. さくらのクラウド CLI Usacloudの設定ファイル

Usacloudの設定ファイルを利用する方法です。
UsacloudにてAPIキーの設定(usacloud configコマンドの実行など)を行なっておけばvagrant-sakura が自動的にUsacloudの設定ファイルを読み込みます。 この機能を利用すればVagrantfileにAPIキー関連の設定を記載する必要はありません。

デフォルトでは~/.usacloud/<current_profile>/config.jsonファイルが利用されます。
任意のUsacloud設定ファイルを利用したい場合、Vagrantfileにconfig_pathを指定することで利用する設定ファイルを指定できます。

  config.vm.provider :sakura do |sakura|
    sakura.config_path = 'your/config/file.json'
    # ...
  end

3. 環境変数

環境変数でAPIキーを指定可能です。
UsacloudやPacker for さくらのクラウドTerraform for さくらのクラウドと共通の環境変数を利用できます。

  • API アクセストークン: SAKURACLOUD_ACCESS_TOKEN または SAKURA_ACCESS_TOKEN
  • API シークレット: SAKURACLOUD_ACCESS_TOKEN_SECRET または SAKURA_ACCESS_TOKEN_SECRET
  • ゾーン: SAKURACLOUD_ZONE

SSH 鍵の指定方法

vagrant-sakura では、サーバにログインするための SSH 公開鍵を 以下の3通りの方法で 設定できます。

  1. コントロールパネルで設定済みの SSH 公開鍵をリソース ID で指定する。 対応する秘密鍵は override.ssh.private_key_path で指定できます。

    sakura.sshkey_id = '101234567890'
    override.ssh.private_key_path = File.expand_path("~/.ssh/vagrant")
    
  2. SSH 公開鍵のパスを指定する。この方法では、ひとつサーバを作成する度に SSH 公開鍵リソースがひとつ作成されます。vagrant-sakura が SSH 公開鍵リソース を削除することはないため、SSH 公開鍵リソースが不必要に増えてしまうことに 注意が必要です。

    sakura.public_key_path        = File.expand_path("~/.ssh/vagrant.pub")
    override.ssh.private_key_path = File.expand_path("~/.ssh/vagrant")
    
  3. Vagrant 付属の "insecure key" をそのまま使う。"insecure key" は安全性に 懸念があるため、sakura.use_insecure_keytrue にセットした時に のみ利用されます。

    sakura.use_insecure_key = true
    

コマンド

OSの再インストール

sakura-reinstall コマンドを使って、ディスクに対しOSの再インストールを行うことができます。

$ vagrant sakura-reinstall
...

各種IDの一覧表示

sakura-list-id コマンドを使って、Vagrantfile で指定するリソース ID を調べることができます。

$ vagrant sakura-list-id
...

設定

さくらのクラウド provider では以下の設定ができます:

  • access_token - さくらのクラウド API にアクセスするための API キー
  • access_token_secret - API キーのシークレットトークン
  • disk_plan - サーバで利用するディスクのプラン ID
  • os_type - サーバで利用するディスクのベースとするアーカイブの種別 (※ disk_source_archiveとは同時に指定できません)
    指定可能な値は以下の通りです。
指定可能な値 SSHユーザー名 Vagrantfileの例 備考
ubuntu(デフォルト) ubuntu example -
ubuntu-20.04 ubuntu - -
ubuntu-18.04 ubuntu - -
ubuntu-16.04 ubuntu - -
centos root example -
centos8 root example -
centos7 root example -
centos6 root example -
debian root example -
debian10 root - -
debian9 root - -
coreos core example -
freebsd root example -
rancheros rancher example メモリ2GB以上のプランが必要
k3os rancher example -
  • disk_source_archive - サーバで利用するディスクのベースとするアーカイブのID (※os_typeとは同時に指定できません)
  • server_name - サーバ名
  • server_plan - 作成するサーバのプラン ID(非推奨 代わりにserver_coreserver_memoryを利用してください)
  • server_core - 作成するサーバのコア数(デフォルト: 1)
  • server_memory - 作成するサーバのメモリサイズ(GB単位、デフォルト: 1)
  • packet_filter - 作成するサーバに適用するパケットフィルタ ID
  • startup_scripts - 作成するサーバに適用するスタートアップスクリプト ID(リスト)
  • enable_pw_auth - パスワード認証の有効化(デフォルト: false)
  • tags - 作成するサーバ/ディスクのタグ(リスト)
  • description - 作成するサーバ/ディスクの説明
  • sshkey_id - サーバへのログインに利用する SSH 公開鍵のリソース ID
  • zone_id - ゾーン ID (石狩第1=is1a, 石狩第2=is1b、東京第1=tk1a、デフォルトはis1b)
  • config_path - APIキーが記載されたUsacloud設定ファイルのパス

ネットワーク

vagrant-sakuraconfig.vm.network を利用したネットワークの構築を まだサポートしていません。

開発

vagrant-sakura プラグインをいじる場合は、リポジトリを clone してから Bundler を使って依存関係を解決してください。

$ bundle

開発中のプラグインをテストするには以下のようにビルドしてからvagrant pluginコマンドでプラグインをインストールします。

bundle exec rake build
vagrant plugin install pkg/vagrant-sakura-*.gem

プラグインをインストール後、Vagrantfile を clone したディレクトリに置いて (.gitignore に書いてあるので git には無視されます)、

開発中の Vagrant 環境をテストすることができます。

$ vagrant up 
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].