From 72b6fe616775c32a9bb1b601eb1e8ac0d5466f85 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Tue, 3 Sep 2013 11:59:49 -0700 Subject: [PATCH] website/docs: bring in changes from docs.vagrantup.com --- website/docs/source/v2/boxes.html.md | 2 +- website/docs/source/v2/cli/box.html.md | 2 +- .../v2/networking/public_network.html.md | 14 +++++++ .../source/v2/provisioning/ansible.html.md | 42 +++++++++---------- 4 files changed, 35 insertions(+), 25 deletions(-) diff --git a/website/docs/source/v2/boxes.html.md b/website/docs/source/v2/boxes.html.md index ee905fe13..18b2196c6 100644 --- a/website/docs/source/v2/boxes.html.md +++ b/website/docs/source/v2/boxes.html.md @@ -15,7 +15,7 @@ Boxes are [provider-specific](/v2/providers/index.html), so you must obtain the proper box depending on what provider you're using. If you're interested in more details on the exact file format of -boxes, there is a seperate [page dedicated to that](/v2/boxes/format.html), since +boxes, there is a separate [page dedicated to that](/v2/boxes/format.html), since it is an advanced topic that general users don't need to know. ## Adding Boxes diff --git a/website/docs/source/v2/cli/box.html.md b/website/docs/source/v2/cli/box.html.md index fe13ba656..d64aa85ad 100644 --- a/website/docs/source/v2/cli/box.html.md +++ b/website/docs/source/v2/cli/box.html.md @@ -19,7 +19,7 @@ The main functionality of this command is exposed via even more subcommands: **Command: `vagrant box add NAME URL`** -This adds a box add the given URL to Vagrant and stores it under the +This adds a box at the given URL to Vagrant and stores it under the logical name `NAME`. The URL may be a file path or an HTTP URL. For HTTP, basic authentication diff --git a/website/docs/source/v2/networking/public_network.html.md b/website/docs/source/v2/networking/public_network.html.md index dd3db38b4..61bb6f033 100644 --- a/website/docs/source/v2/networking/public_network.html.md +++ b/website/docs/source/v2/networking/public_network.html.md @@ -36,3 +36,17 @@ end When DHCP is used, the IP can be determined by using `vagrant ssh` to SSH into the machine and using the appropriate command line tool to find the IP, such as `ifconfig`. + +## Default Network Interface + +If more than one network interface is available on the host machine, Vagrant will +ask you to choose which interface the virtual machine should bridge to. A default +interface can be specified by adding a `:bridge` clause to the network definition. + +```ruby +config.vm.network :public_network, :bridge => 'en1: Wi-Fi (AirPort)' +``` + +The string identifying the desired interface must exactly match the name of an +available interface. If it can't be found, Vagrant will ask you to pick +from a list of available network interfaces. diff --git a/website/docs/source/v2/provisioning/ansible.html.md b/website/docs/source/v2/provisioning/ansible.html.md index d9b2d1259..beb19b1f6 100644 --- a/website/docs/source/v2/provisioning/ansible.html.md +++ b/website/docs/source/v2/provisioning/ansible.html.md @@ -17,13 +17,18 @@ a single page of documentation. ## Inventory File -Out of the box, Ansible can control with multiple systems in your infrastructure at the -same time. It does this by selecting portions of systems listed in Ansible's inventory -INI formatted file, which defaults to being located at `/etc/ansible/hosts`. This same -file can be used with Vagrant, or the `ansible.inventory_file` option can be specified to -direct Vagrant to use an inventory file dedicated to your Vagrant project. Using this option -is recommended to avoid accidentally running playbooks against live infrastructure. A simple -inventory file for use with Vagrant might look like: +When using Ansible, it needs to know on which machines a given playbook should run. It does +this by way of an inventory file which lists those machines. In the context of Vagrant, +there are two ways to approach working with inventory files. The first and simplest option +is to not provide one to Vagrant at all. Vagrant will generate inventory files for each +virtual machine it manages, and use them for provisioning machines. Generated inventory files +are created adjacent to your Vagrantfile, named using the machine names set in your Vagrantfile. + +The second option is for situations where you'd like to have more than one virtual machine +in a single inventory file, perhaps leveraging more complex playbooks or inventory grouping. +If you provide the `ansible.inventory_path` option referencing a specific inventory file +dedicated to your Vagrant project, that one will be used instead of generating them. +Such an inventory file for use with Vagrant might look like: ``` [vagrant] @@ -36,10 +41,6 @@ Where the above IP address is one set in your Vagrantfile: config.vm.network :private_network, ip: "192.168.111.222" ``` -(While Vagrant does have the IP address of your VM, entering it into an Ansible inventory -file is preferred so that Ansible's `group_vars` and `host_vars` can be used; Their location -is derived from the location of the inventory file.) - ## Playbook The second component of a successful Ansible provisioner setup is the Ansible playbook @@ -52,7 +53,7 @@ if it was updated) the NTP daemon via YUM looks like: ``` --- -- hosts: vagrant +- hosts: all tasks: - name: ensure ntpd is at the latest version yum: pkg=ntp state=latest @@ -75,34 +76,30 @@ To run Ansible against your Vagrant guest, the basic Vagrantfile configuration l Vagrant.configure("2") do |config| config.vm.provision :ansible do |ansible| ansible.playbook = "playbook.yml" - ansible.inventory_file = "ansible_hosts" end end ``` -This causes Vagrant to run the `playbook.yml` playbook against the `vagrant` group in the -`ansible_hosts` file, both of which are adjacent to the Vagrantfile. Since an Ansible playbook -can include many files, you may also collect the related files in a directory structure like this: +This causes Vagrant to run the `playbook.yml` playbook against all hosts in the inventory file. +Since an Ansible playbook can include many files, you may also collect the related files in +a directory structure like this: ``` $ tree . |-- Vagrantfile |-- provisioning -| |-- ansible_hosts | |-- group_vars -| |-- vagrant +| |-- all | |-- playbook.yml ``` -In such an arrangement, the `ansible.playbook` and `ansible.inventory_file` options should be -adjusted accordingly: +In such an arrangement, the `ansible.playbook` path should be adjusted accordingly: ```ruby Vagrant.configure("2") do |config| config.vm.provision :ansible do |ansible| ansible.playbook = "provisioning/playbook.yml" - ansible.inventory_file = "provisioning/ansible_hosts" end end ``` @@ -125,7 +122,6 @@ These variables take the highest precedence over any other variables. by the sudo command. * `ansible.ask_sudo_pass` can be set to `true` to require Ansible to prompt for a sudo password. * `ansible.limit` can be set to a string or an array of machines or groups from the inventory file -to further narrow down which hosts are affected. This option is best used in the case where you -are using an inventory file containing more than just the Vagrant guest. +to further narrow down which hosts are affected. * `ansible.verbose` can be set to `true` to increase Ansible's verbosity to obtain more detailed logging during playbook execution.