~nskaggs/+junk/xenial-test

« back to all changes in this revision

Viewing changes to src/github.com/juju/govmomi/govc/README.md

  • Committer: Nicholas Skaggs
  • Date: 2016-10-24 20:56:05 UTC
  • Revision ID: nicholas.skaggs@canonical.com-20161024205605-z8lta0uvuhtxwzwl
Initi with beta15

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# govc
 
2
 
 
3
govc is a vSphere CLI built on top of govmomi.
 
4
 
 
5
## Installation
 
6
 
 
7
You can find prebuilt govc binaries on the [releases page](https://github.com/vmware/govmomi/releases).
 
8
 
 
9
Download and install a binary locally like this:
 
10
 
 
11
```sh
 
12
curl $URL_TO_BINARY | gzip -d > /usr/local/bin/govc
 
13
chmod +x /usr/local/bin/govc
 
14
```
 
15
 
 
16
### Source
 
17
 
 
18
You can install the latest govc version from source if you have the Go toolchain installed.
 
19
 
 
20
```sh
 
21
go get github.com/vmware/govmomi/govc
 
22
```
 
23
 
 
24
(make sure `$GOPATH/bin` is in your `PATH`)
 
25
 
 
26
## Usage
 
27
 
 
28
govc exposes its functionality through subcommands. Option flags
 
29
to these subcommands are often shared.
 
30
 
 
31
Common flags include:
 
32
 
 
33
* `-u`: ESXi or vCenter URL (ex: `user:pass@host`)
 
34
* `-debug`: Trace requests and responses (to `~/.govmomi/debug`)
 
35
 
 
36
Managed entities can be referred to by their absolute path or by their relative
 
37
path. For example, when specifying a datastore to use for a subcommand, you can
 
38
either specify it as `/mydatacenter/datastore/mydatastore`, or as
 
39
`mydatastore`. If you're not sure about the name of the datastore, or even the
 
40
full path to the datastore, you can specify a pattern to match. Both
 
41
`/*center/*/my*` (absolute) and `my*store` (relative) will resolve to the same
 
42
datastore, given there are no other datastores that match those globs.
 
43
 
 
44
The relative path in this example can only be used if the command can
 
45
umambigously resolve a datacenter to use as origin for the query. If no
 
46
datacenter is specified, govc defaults to the only datacenter, if there is only
 
47
one. The datacenter itself can be specified as a pattern as well, enabling the
 
48
following arguments: `-dc='my*' -ds='*store'`. The datastore pattern is looked
 
49
up and matched relative to the datacenter which itself is specified as a
 
50
pattern.
 
51
 
 
52
Besides specifying managed entities as arguments, they can also be specified
 
53
using environment variables. The following environment variables are used by govc
 
54
to set defaults:
 
55
 
 
56
* `GOVC_URL`: URL of ESXi or vCenter instance to connect to.
 
57
 
 
58
  > The URL scheme defaults to `https` and the URL path defaults to `/sdk`.
 
59
  > This means that specifying `user:pass@host` is equivalent to
 
60
  > `https://user:pass@host/sdk`.
 
61
 
 
62
* `GOVC_INSECURE`: Allow establishing insecure connections.
 
63
 
 
64
  > Use this option when the host you're connecting is using self-signed
 
65
  > certificates, or is otherwise trusted. Set this option to `1` to enable.
 
66
 
 
67
* `GOVC_DATACENTER`
 
68
 
 
69
* `GOVC_DATASTORE`
 
70
 
 
71
* `GOVC_NETWORK`
 
72
 
 
73
* `GOVC_RESOURCE_POOL`
 
74
 
 
75
* `GOVC_HOST`
 
76
 
 
77
* `GOVC_GUEST_LOGIN`: Guest credentials for guest operations
 
78
 
 
79
## Examples
 
80
 
 
81
* [Upload ssh public key to a VM](examples/lib/ssh.sh)
 
82
 
 
83
* [Create and configure a vCenter VM](examples/vcsa.sh)
 
84
 
 
85
## Projects using govc
 
86
 
 
87
* [Kubernetes vSphere Provider](https://github.com/GoogleCloudPlatform/kubernetes/tree/master/cluster/vsphere)
 
88
 
 
89
## License
 
90
 
 
91
govc is available under the [Apache 2 license](../LICENSE).