3
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Vagrantfile の自動生成コメントを訳してみた

Last updated at Posted at 2017-05-31


# -*- mode: ruby -*-
# vi: set ft=ruby :

# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant の設定は全て以下で行われる。「Vagrant.configureのところの"2"
いうのはコンフィギュレーションバージョンを"2"に設定する。(以前のスタイルの
記法も後方互換のためにサポートされる。)

Vagrant.configure("2") do |config|

# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.
典型的な設定項目を以下に記述しまたコメント補足してある詳細なリファレンスは
オンラインのドキュメントをみて欲しい

# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
すべてのVagrant 開発環境では"box"が必須であるatlasサイトにさまざまなboxが
公開されている

config.vm.box = "base"


# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
# `vagrant box outdated`. This is not recommended.
この項目をコメントアウトするとboxの自動アップデートを止められます
もし自動アップデートを止めるとユーザーが明示的に'vagrant box outdated'
コマンドを実行した場合に限りアップデートがないか確認するようになります
これは推奨はされません

 config.vm.box_check_update = false


# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
# NOTE: This will enable public access to the opened port
ポートフォワーディングのマッピングを作成しますこれによりホストマシンのポート
から仮想マシンの特定のポートへとアクセスできるようになります下記の例では
"localhost:8080"にアクセスすると仮想マシンの80番ポートに接続できるでしょう
これはホストマシンのポートが外部へ開放されているのであれば外部からの仮想マシンへのアクセスをも可能にします

 config.vm.network "forwarded_port", guest: 80, host: 8080


# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine and only allow access
# via 127.0.0.1 to disable public access
ポートフォワーディングのマッピングを作成しますこれによりホストマシンのポート
から仮想マシンの特定のポートへとアクセスできるようになりますがループバック
アドレスからのアクセスのみを許可し外部からのアクセスは許可しませんすなわち
ホストマシン上からのみアクセスできます

 config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1"


# Create a private network, which allows host-only access to the machine
# using a specific IP.
内部ネットワークを作成しますここで指定したIPアドレスでホストオンリーの接続が
できるようになります。(仮想マシン同士の通信または仮想マシンとホストマシンと
の通信はできるが仮想マシンとホストマシン以外の物理マシンとの通信はできない
訳注仮想マシンとホストマシンとの通信もできないように思われるが未検証。)

 config.vm.network "private_network", ip: "192.168.33.10"


# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
外部ネットワークを作成しますこれは通例ブリッジネットワーク用途ですブリッジ
ネットワークは仮想マシンをネットワーク上にあたかももう1台物理マシンが存在する
かのように見せます

 config.vm.network "public_network"

# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
仮想マシンとの共有フォルダを追加します第1引数にはホストマシンの実際の
フォルダのパスを指定し第2引数には仮想マシン上にマウントさせるパスを
指定しますそして省略可能な第3引数としてさまざまな設定項目一式のセット
がありますが詳細は省略。)

 config.vm.synced_folder "../data", "/vagrant_data"


# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
プロバイダー特有の設定項目でVagrant のバックグラウンドで動くさまざまなプロバ
イダーを細かく設定できます
Virtualbox の例を挙げます

#
●● config.vm.provider "virtualbox" do |vb|

# # Display the VirtualBox GUI when booting the machine
仮想マシンの起動時にVirtualbox の仮想ウィンドウ仮想マシンのコンソール画面
を表示する

 vb.gui = true

#
# # Customize the amount of memory on the VM:
仮想マシンのメモリサイズを設定します

 vb.memory = "1024"
●● end

#
# View the documentation for the provider you are using for more
# information on available options.
ドキュメントを見ればあなたが利用しているプロバイダーで利用可能なオプション
についての情報が得られるでしょう

# Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
# such as FTP and Heroku are also available. See the documentation at
# https://docs.vagrantup.com/v2/push/atlas.html for more information.
Atlas サイトへ Push するスケジュールを指定できます他にもFTP とかHeroku など
へPush することもできますくわしくはドキュメントを見てください

●● config.push.define "atlas" do |push|
 push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
●● end

# Enable provisioning with a shell script. Additional provisioners such as
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
# documentation for more information about their specific syntax and use.
シェルスクリプトによるプロビジョニングを有効にします他にもPuppetChef
AnsibleSaltそしてDocker などのプロビジョニングツールを使うこともできるでしょう
詳しくはドキュメントをみればシンタックスとか用途とかが確認できるでしょう

●● config.vm.provision "shell", inline: <<-SHELL
● apt-get update
● apt-get install -y apache2
●● SHELL

end

という感じ。

3
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?