Skip to content

Commit

Permalink
Document helpful provisioners
Browse files Browse the repository at this point in the history
fixes mitchellh#262, partially implements mitchellh#261
  • Loading branch information
gdubicki committed Mar 13, 2022
1 parent d93221c commit ce22c2e
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ The maintainers for this plugin are @temikus(primary), @erjohnso(backup).
* Define zone-specific configurations so Vagrant can manage machines in
multiple zones.

## Usage
## Installation

Install using standard Vagrant 1.1+ plugin installation methods. After
installing, `vagrant up` and specify the `google` provider. For example,
Expand Down Expand Up @@ -299,6 +299,33 @@ Since plugin version 2.0, this is implemented via built-in `SyncedFolders` actio
See Vagrant's [rsync action](https://www.vagrantup.com/docs/synced-folders/rsync.html)
documentation for more info.

## Automatic shutdown

To save money you may want to ensure you don't forget to shut down your instances
when you stop using them.

A very basic solution for this is to use Vagrant's provisioning feature to plan
automatic shutdown of the vm after given time after each `vagrant up`:

```ruby
# Plan automatic shutdown of machine to prevent unwanted costs
config.vm.provision "auto-shutdown", type: "shell", run: "always",
inline: "shutdown -P +480" # = 60 minutes * 8 hours
```

## Print external IP

You may want to know your machine's external IP f.e. to put it in your Ansible inventory
or open the app you deploy in it in your browser.

To automate printing it IP you can also use the Vagrant's provisioning feature:

```ruby
# Print the external IP
config.vm.provision "print-ip", type: "shell", run: "always",
inline: "echo External IP: $(curl -s icanhazip.com)"
```

## Development

To work on the `vagrant-google` plugin, clone this repository, and use
Expand Down

0 comments on commit ce22c2e

Please sign in to comment.