OSDN Git Service

Regular updates
[twpd/master.git] / vagrantfile.md
1 ---
2 title: Vagrantfile
3 category: Devops
4 layout: 2017/sheet
5 ---
6
7 ## Vagrantfile
8 {: .-one-column}
9
10 ```rb
11 Vagrant.configure("2") do |config|
12   # All Vagrant configuration is done here. The most common configuration
13   # options are documented and commented below. For a complete reference,
14   # please see the online documentation at vagrantup.com.
15
16   # Every Vagrant virtual environment requires a box to build off of.
17   config.vm.box = "precise64"
18
19   # The url from where the 'config.vm.box' box will be fetched if it
20   # doesn't already exist on the user's system.
21   # config.vm.box_url = "http://domain.com/path/to/above.box"
22
23   # Create a forwarded port mapping which allows access to a specific port
24   # within the machine from a port on the host machine. In the example below,
25   # accessing "localhost:8080" will access port 80 on the guest machine.
26   # config.vm.network :forwarded_port, guest: 80, host: 8080
27
28   # Create a private network, which allows host-only access to the machine
29   # using a specific IP.
30   # config.vm.network :private_network, ip: "192.168.33.10"
31
32   # Create a public network, which generally matched to bridged network.
33   # Bridged networks make the machine appear as another physical device on
34   # your network.
35   # config.vm.network :public_network
36
37   # If true, then any SSH connections made will enable agent forwarding.
38   # Default value: false
39   # config.ssh.forward_agent = true
40
41   # Share an additional folder to the guest VM. The first argument is
42   # the path on the host to the actual folder. The second argument is
43   # the path on the guest to mount the folder. And the optional third
44   # argument is a set of non-required options.
45   # config.vm.synced_folder "../data", "/vagrant_data"
46
47   # Provider-specific configuration so you can fine-tune various
48   # backing providers for Vagrant. These expose provider-specific options.
49   # Example for VirtualBox:
50   #
51   # config.vm.provider :virtualbox do |vb|
52   #   # Don't boot with headless mode
53   #   vb.gui = true
54   #
55   #   # Use VBoxManage to customize the VM. For example to change memory:
56   #   vb.customize ["modifyvm", :id, "--memory", "1024"]
57   # end
58   #
59   # View the documentation for the provider you're using for more
60   # information on available options.
61
62   # Enable provisioning with Puppet stand alone.  Puppet manifests
63   # are contained in a directory path relative to this Vagrantfile.
64   # You will need to create the manifests directory and a manifest in
65   # the file precise64.pp in the manifests_path directory.
66   #
67   # An example Puppet manifest to provision the message of the day:
68   #
69   # # group { "puppet":
70   # #   ensure => "present",
71   # # }
72   # #
73   # # File { owner => 0, group => 0, mode => 0644 }
74   # #
75   # # file { '/etc/motd':
76   # #   content => "Welcome to your Vagrant-built virtual machine!
77   # #               Managed by Puppet.\n"
78   # # }
79   #
80   # config.vm.provision :puppet do |puppet|
81   #   puppet.manifests_path = "manifests"
82   #   puppet.manifest_file  = "init.pp"
83   # end
84
85   # Enable provisioning with chef solo, specifying a cookbooks path, roles
86   # path, and data_bags path (all relative to this Vagrantfile), and adding
87   # some recipes and/or roles.
88   #
89   # config.vm.provision :chef_solo do |chef|
90   #   chef.cookbooks_path = "../my-recipes/cookbooks"
91   #   chef.roles_path = "../my-recipes/roles"
92   #   chef.data_bags_path = "../my-recipes/data_bags"
93   #   chef.add_recipe "mysql"
94   #   chef.add_role "web"
95   #
96   #   # You may also specify custom JSON attributes:
97   #   chef.json = { :mysql_password => "foo" }
98   # end
99
100   # Enable provisioning with chef server, specifying the chef server URL,
101   # and the path to the validation key (relative to this Vagrantfile).
102   #
103   # The Opscode Platform uses HTTPS. Substitute your organization for
104   # ORGNAME in the URL and validation key.
105   #
106   # If you have your own Chef Server, use the appropriate URL, which may be
107   # HTTP instead of HTTPS depending on your configuration. Also change the
108   # validation key to validation.pem.
109   #
110   # config.vm.provision :chef_client do |chef|
111   #   chef.chef_server_url = "https://api.opscode.com/organizations/ORGNAME"
112   #   chef.validation_key_path = "ORGNAME-validator.pem"
113   # end
114   #
115   # If you're using the Opscode platform, your validator client is
116   # ORGNAME-validator, replacing ORGNAME with your organization name.
117   #
118   # If you have your own Chef Server, the default validation client name is
119   # chef-validator, unless you changed the configuration.
120   #
121   #   chef.validation_client_name = "ORGNAME-validator"
122 end
123 ```
124
125 ## Also see
126
127 * [Vagrant cheatsheet](./vagrant)