knife-vcenter 2.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/{LICENSE.txt → LICENSE} +0 -0
- data/lib/base.rb +8 -3
- data/lib/chef/knife/cloud/vcenter_service.rb +117 -81
- data/lib/chef/knife/cloud/vcenter_service_helpers.rb +15 -3
- data/lib/chef/knife/cloud/vcenter_service_options.rb +18 -17
- data/lib/chef/knife/vcenter_cluster_list.rb +19 -13
- data/lib/chef/knife/vcenter_datacenter_list.rb +19 -13
- data/lib/chef/knife/vcenter_host_list.rb +28 -19
- data/lib/chef/knife/vcenter_vm_clone.rb +39 -28
- data/lib/chef/knife/vcenter_vm_create.rb +26 -21
- data/lib/chef/knife/vcenter_vm_delete.rb +15 -10
- data/lib/chef/knife/vcenter_vm_list.rb +31 -21
- data/lib/chef/knife/vcenter_vm_show.rb +12 -13
- data/lib/knife-vcenter/version.rb +4 -2
- data/lib/lookup_service_helper.rb +421 -427
- data/lib/sso.rb +213 -218
- data/lib/support/clone_vm.rb +4 -4
- data/spec/spec_helper.rb +2 -2
- data/spec/unit/vcenter_vm_list_spec.rb +21 -22
- metadata +6 -58
- data/.github/ISSUE_TEMPLATE.md +0 -22
- data/.github/PULL_REQUEST_TEMPLATE.md +0 -14
- data/.gitignore +0 -21
- data/.rubocop.yml +0 -18
- data/.travis.yml +0 -16
- data/CHANGELOG.md +0 -34
- data/Gemfile +0 -3
- data/README.md +0 -219
- data/Rakefile +0 -20
- data/knife-vcenter.gemspec +0 -37
data/lib/support/clone_vm.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
#
|
3
3
|
# Author:: Chef Partner Engineering (<partnereng@chef.io>)
|
4
|
-
# Copyright:: Copyright (c) 2017 Chef Software, Inc.
|
4
|
+
# Copyright:: Copyright (c) 2017-2018 Chef Software, Inc.
|
5
5
|
# License:: Apache License, Version 2.0
|
6
6
|
#
|
7
7
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -17,7 +17,7 @@
|
|
17
17
|
# limitations under the License.
|
18
18
|
#
|
19
19
|
|
20
|
-
require
|
20
|
+
require "rbvmomi"
|
21
21
|
|
22
22
|
class Support
|
23
23
|
class CloneVm
|
@@ -64,10 +64,10 @@ class Support
|
|
64
64
|
if new_vm.nil?
|
65
65
|
puts format("Unable to find machine: %s", name)
|
66
66
|
else
|
67
|
-
puts
|
67
|
+
puts "Waiting for network interfaces to become available..."
|
68
68
|
sleep 2 while new_vm.guest.net.empty? || !new_vm.guest.ipAddress
|
69
69
|
new_vm.guest.net[0].ipConfig.ipAddress.detect do |addr|
|
70
|
-
addr.origin !=
|
70
|
+
addr.origin != "linklayer"
|
71
71
|
end.ipAddress
|
72
72
|
end
|
73
73
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
#
|
3
3
|
# Author:: Chef Partner Engineering (<partnereng@chef.io>)
|
4
|
-
# Copyright:: Copyright (c) 2017 Chef Software, Inc.
|
4
|
+
# Copyright:: Copyright (c) 2017-2018 Chef Software, Inc.
|
5
5
|
# License:: Apache License, Version 2.0
|
6
6
|
#
|
7
7
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -15,4 +15,4 @@
|
|
15
15
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
16
|
# See the License for the specific language governing permissions and
|
17
17
|
# limitations under the License.
|
18
|
-
#
|
18
|
+
#
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
#
|
3
3
|
# Author:: Chef Partner Engineering (<partnereng@chef.io>)
|
4
|
-
# Copyright:: Copyright (c) 2017 Chef Software, Inc.
|
4
|
+
# Copyright:: Copyright (c) 2017-2018 Chef Software, Inc.
|
5
5
|
# License:: Apache License, Version 2.0
|
6
6
|
#
|
7
7
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -17,9 +17,9 @@
|
|
17
17
|
# limitations under the License.
|
18
18
|
#
|
19
19
|
|
20
|
-
require
|
21
|
-
require
|
22
|
-
require
|
20
|
+
require "spec_helper"
|
21
|
+
require "chef/knife/vcenter_vm_list"
|
22
|
+
require "support/shared_examples_for_command"
|
23
23
|
|
24
24
|
class PowerStatus < BasicObject
|
25
25
|
attr_reader :value
|
@@ -33,35 +33,34 @@ describe Chef::Knife::Cloud::VcenterVmList do
|
|
33
33
|
|
34
34
|
subject { described_class.new }
|
35
35
|
|
36
|
-
describe
|
36
|
+
describe "#format_power_status" do
|
37
37
|
context 'when the power is "POWERED_ON"' do
|
38
|
-
it
|
39
|
-
expect(subject.ui).to receive(:color).with(
|
40
|
-
subject.format_power_status(PowerStatus.new(
|
38
|
+
it "displays with green" do
|
39
|
+
expect(subject.ui).to receive(:color).with("POWERED_ON", :green)
|
40
|
+
subject.format_power_status(PowerStatus.new("POWERED_ON"))
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
44
|
context 'when the power is "POWERED_OFF"' do
|
45
|
-
it
|
46
|
-
expect(subject.ui).to receive(:color).with(
|
47
|
-
subject.format_power_status(PowerStatus.new(
|
45
|
+
it "displays with red" do
|
46
|
+
expect(subject.ui).to receive(:color).with("POWERED_OFF", :red)
|
47
|
+
subject.format_power_status(PowerStatus.new("POWERED_OFF"))
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
51
|
context 'when the power is "SUSPENDED"' do
|
52
|
-
it
|
53
|
-
expect(subject.ui).to receive(:color).with(
|
54
|
-
subject.format_power_status(PowerStatus.new(
|
55
|
-
end
|
56
|
-
end
|
52
|
+
it "displays with red" do
|
53
|
+
expect(subject.ui).to receive(:color).with("SUSPENDED", :yellow)
|
54
|
+
subject.format_power_status(PowerStatus.new("SUSPENDED"))
|
55
|
+
end
|
56
|
+
end
|
57
57
|
end
|
58
58
|
|
59
|
-
describe
|
60
|
-
context
|
61
|
-
it
|
62
|
-
expect(subject.
|
63
|
-
subject.format_memory_value(8192)
|
59
|
+
describe "#format_memory_value" do
|
60
|
+
context "when the memory value is 8192" do
|
61
|
+
it "returns 8,192" do
|
62
|
+
expect(subject.format_memory_value(8192)).to eq("8,192")
|
64
63
|
end
|
65
64
|
end
|
66
65
|
end
|
67
|
-
end
|
66
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: knife-vcenter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chef Partner Engineering
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-11-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: knife-cloud
|
@@ -108,20 +108,6 @@ dependencies:
|
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: github_changelog_generator
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - ">="
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '0'
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - ">="
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: '0'
|
125
111
|
- !ruby/object:Gem::Dependency
|
126
112
|
name: pry
|
127
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -136,34 +122,6 @@ dependencies:
|
|
136
122
|
- - ">="
|
137
123
|
- !ruby/object:Gem::Version
|
138
124
|
version: '0'
|
139
|
-
- !ruby/object:Gem::Dependency
|
140
|
-
name: rake
|
141
|
-
requirement: !ruby/object:Gem::Requirement
|
142
|
-
requirements:
|
143
|
-
- - "~>"
|
144
|
-
- !ruby/object:Gem::Version
|
145
|
-
version: '10.0'
|
146
|
-
type: :development
|
147
|
-
prerelease: false
|
148
|
-
version_requirements: !ruby/object:Gem::Requirement
|
149
|
-
requirements:
|
150
|
-
- - "~>"
|
151
|
-
- !ruby/object:Gem::Version
|
152
|
-
version: '10.0'
|
153
|
-
- !ruby/object:Gem::Dependency
|
154
|
-
name: rubocop
|
155
|
-
requirement: !ruby/object:Gem::Requirement
|
156
|
-
requirements:
|
157
|
-
- - "~>"
|
158
|
-
- !ruby/object:Gem::Version
|
159
|
-
version: '0.35'
|
160
|
-
type: :development
|
161
|
-
prerelease: false
|
162
|
-
version_requirements: !ruby/object:Gem::Requirement
|
163
|
-
requirements:
|
164
|
-
- - "~>"
|
165
|
-
- !ruby/object:Gem::Version
|
166
|
-
version: '0.35'
|
167
125
|
- !ruby/object:Gem::Dependency
|
168
126
|
name: ruby-debug-ide
|
169
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -185,17 +143,7 @@ executables: []
|
|
185
143
|
extensions: []
|
186
144
|
extra_rdoc_files: []
|
187
145
|
files:
|
188
|
-
-
|
189
|
-
- ".github/PULL_REQUEST_TEMPLATE.md"
|
190
|
-
- ".gitignore"
|
191
|
-
- ".rubocop.yml"
|
192
|
-
- ".travis.yml"
|
193
|
-
- CHANGELOG.md
|
194
|
-
- Gemfile
|
195
|
-
- LICENSE.txt
|
196
|
-
- README.md
|
197
|
-
- Rakefile
|
198
|
-
- knife-vcenter.gemspec
|
146
|
+
- LICENSE
|
199
147
|
- lib/base.rb
|
200
148
|
- lib/chef/knife/cloud/vcenter_service.rb
|
201
149
|
- lib/chef/knife/cloud/vcenter_service_helpers.rb
|
@@ -216,7 +164,7 @@ files:
|
|
216
164
|
- spec/unit/vcenter_vm_list_spec.rb
|
217
165
|
homepage: https://github.com/chef/knife-vcenter
|
218
166
|
licenses:
|
219
|
-
- Apache
|
167
|
+
- Apache-2.0
|
220
168
|
metadata: {}
|
221
169
|
post_install_message:
|
222
170
|
rdoc_options: []
|
@@ -234,10 +182,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
234
182
|
version: '0'
|
235
183
|
requirements: []
|
236
184
|
rubyforge_project:
|
237
|
-
rubygems_version: 2.6
|
185
|
+
rubygems_version: 2.7.6
|
238
186
|
signing_key:
|
239
187
|
specification_version: 4
|
240
188
|
summary: Knife plugin to VMware vCenter.
|
241
189
|
test_files:
|
242
|
-
- spec/spec_helper.rb
|
243
190
|
- spec/unit/vcenter_vm_list_spec.rb
|
191
|
+
- spec/spec_helper.rb
|
data/.github/ISSUE_TEMPLATE.md
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
### Versions:
|
2
|
-
<!--- Version of the software where you are encountering the issue --->
|
3
|
-
<!-- You should probably update in this is not newest release.--->
|
4
|
-
* Version of knife-vcenter:
|
5
|
-
* Version of chef:
|
6
|
-
|
7
|
-
### Platform Details
|
8
|
-
<!--- What version of vCenter are you running? What version of ESXi are you using too?--->
|
9
|
-
* Version of vCenter:
|
10
|
-
* Version of ESXi:
|
11
|
-
|
12
|
-
### Scenario:
|
13
|
-
<!--- What you are trying to achieve and you can't?--->
|
14
|
-
|
15
|
-
### Steps to Reproduce:
|
16
|
-
<!--- If you are filing an issue what are the things we need to do in order to repro your problem? How are you using this gem or any resources it includes?--->
|
17
|
-
|
18
|
-
### Expected Result:
|
19
|
-
<!--- What are you expecting to happen as the consequence of above reproduction steps?--->
|
20
|
-
|
21
|
-
### Actual Result:
|
22
|
-
<!--- What actually happens after the reproduction steps? Include the error output or a link to a gist if possible.--->
|
@@ -1,14 +0,0 @@
|
|
1
|
-
### Description
|
2
|
-
|
3
|
-
<!--- Describe what this change achieves--->
|
4
|
-
|
5
|
-
### Issues Resolved
|
6
|
-
|
7
|
-
<!--- List any existing issues this PR resolves--->
|
8
|
-
|
9
|
-
### Check List
|
10
|
-
|
11
|
-
- [ ] All tests pass.
|
12
|
-
- [ ] All style checks pass.
|
13
|
-
- [ ] Functionality includes testing.
|
14
|
-
- [ ] Functionality has been documented in the README if applicable
|
data/.gitignore
DELETED
data/.rubocop.yml
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
AllCops:
|
2
|
-
Exclude:
|
3
|
-
- 'spec/**/*'
|
4
|
-
- 'vendor/**/*'
|
5
|
-
vendor/AbcSize:
|
6
|
-
Max: 30
|
7
|
-
Metrics/LineLength:
|
8
|
-
Max: 150
|
9
|
-
Metrics/MethodLength:
|
10
|
-
Max: 30
|
11
|
-
Style/Documentation:
|
12
|
-
Enabled: false
|
13
|
-
Style/SignalException:
|
14
|
-
Enabled: false
|
15
|
-
Style/SpaceAroundEqualsInParameterDefault:
|
16
|
-
EnforcedStyle: no_space
|
17
|
-
Style/SpaceInsideBrackets:
|
18
|
-
Enabled: false
|
data/.travis.yml
DELETED
data/CHANGELOG.md
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
# Change Log
|
2
|
-
|
3
|
-
## [2.0.0](https://github.com/chef/knife-vcenter/tree/2.0.0) (2017-09-15)
|
4
|
-
[Full Changelog](https://github.com/chef/knife-vcenter/compare/v1.1.1...2.0.0)
|
5
|
-
|
6
|
-
**Merged pull requests:**
|
7
|
-
|
8
|
-
- Unpinning Chef, because it is an dependency. [\#8](https://github.com/chef/knife-vcenter/pull/8) ([jjasghar](https://github.com/jjasghar))
|
9
|
-
|
10
|
-
## [v1.1.1](https://github.com/chef/knife-vcenter/tree/v1.1.1) (2017-09-14)
|
11
|
-
[Full Changelog](https://github.com/chef/knife-vcenter/compare/v1.1.0...v1.1.1)
|
12
|
-
|
13
|
-
**Merged pull requests:**
|
14
|
-
|
15
|
-
- 6.6 vSphere sdk release [\#7](https://github.com/chef/knife-vcenter/pull/7) ([jjasghar](https://github.com/jjasghar))
|
16
|
-
|
17
|
-
## [v1.1.0](https://github.com/chef/knife-vcenter/tree/v1.1.0) (2017-09-13)
|
18
|
-
[Full Changelog](https://github.com/chef/knife-vcenter/compare/v1.0.0...v1.1.0)
|
19
|
-
|
20
|
-
**Merged pull requests:**
|
21
|
-
|
22
|
-
- Updated to make resource\_pool and targethost optional [\#6](https://github.com/chef/knife-vcenter/pull/6) ([russellseymour](https://github.com/russellseymour))
|
23
|
-
|
24
|
-
## [v1.0.0](https://github.com/chef/knife-vcenter/tree/v1.0.0) (2017-08-28)
|
25
|
-
**Merged pull requests:**
|
26
|
-
|
27
|
-
- Added new option to state wether vCenter SDK logs should be displayed [\#4](https://github.com/chef/knife-vcenter/pull/4) ([russellseymour](https://github.com/russellseymour))
|
28
|
-
- 1.0.0 release [\#3](https://github.com/chef/knife-vcenter/pull/3) ([jjasghar](https://github.com/jjasghar))
|
29
|
-
- Walking through the knife-vcenter code [\#2](https://github.com/chef/knife-vcenter/pull/2) ([jjasghar](https://github.com/jjasghar))
|
30
|
-
- Useful information for public release. [\#1](https://github.com/chef/knife-vcenter/pull/1) ([jjasghar](https://github.com/jjasghar))
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
|
data/Gemfile
DELETED
data/README.md
DELETED
@@ -1,219 +0,0 @@
|
|
1
|
-
# knife-vcenter
|
2
|
-
|
3
|
-
[](https://rubygems.org/gems/knife-vcenter)
|
4
|
-
[](https://travis-ci.org/chef/knife-vcenter)
|
5
|
-
[](https://gemnasium.com/chef/knife-vcenter)
|
6
|
-
[](http://inch-ci.org/github/chef/knife-vcenter)
|
7
|
-
|
8
|
-
This is the official Chef Knife plugin for VMware REST API. This plugin gives knife the ability to create, bootstrap, and manage VMware vms.
|
9
|
-
- Documentation: [https://github.com/chef/knife-vcenter/blob/master/README.md](https://github.com/chef/knife-vcenter/blob/master/README.md)
|
10
|
-
- Source: [https://github.com/chef/knife-vcenter/tree/master](https://github.com/chef/knife-vcenter/tree/master)
|
11
|
-
- Issues: [https://github.com/chef/knife-vcenter/issues](https://github.com/chef/knife-vcenter/issues)
|
12
|
-
- Slack: sign up: https://code.vmware.com/slack/ slack channel: #chef
|
13
|
-
- Mailing list: [https://discourse.chef.io/](https://discourse.chef.io/)
|
14
|
-
|
15
|
-
This is a `knife` plugin that allows interaction with vSphere using the vSphere Automation SDK.
|
16
|
-
|
17
|
-
Please refer to the [CHANGELOG](CHANGELOG.md) for version history and known issues.
|
18
|
-
|
19
|
-
## Requirements
|
20
|
-
|
21
|
-
- Chef 13.0 higher
|
22
|
-
- Ruby 2.3.3 or higher
|
23
|
-
|
24
|
-
## Installation
|
25
|
-
|
26
|
-
This driver has a dependency. It requires the [vSphere Automation SDK](https://github.com/vmware/vsphere-automation-sdk-ruby) be installed. The steps to do that are as follows:
|
27
|
-
|
28
|
-
- `$ git clone` [https://github.com/vmware/vsphere-automation-sdk-ruby.git](https://github.com/vmware/vsphere-automation-sdk-ruby.git)
|
29
|
-
- `cd vsphere-automation-sdk-ruby`
|
30
|
-
- `gem build vsphere-automation-sdk-ruby.gemspec`
|
31
|
-
- `chef gem install vsphere-automation-sdk-<version>.gem`
|
32
|
-
|
33
|
-
Using [ChefDK](https://downloads.chef.io/chef-dk/), simply install the Gem:
|
34
|
-
|
35
|
-
```bash
|
36
|
-
chef gem install knife-vcenter
|
37
|
-
```
|
38
|
-
|
39
|
-
If you're using bundler, simply add Chef and knife-vcenter to your Gemfile:
|
40
|
-
|
41
|
-
```ruby
|
42
|
-
gem 'chef'
|
43
|
-
gem 'knife-vcenter'
|
44
|
-
```
|
45
|
-
|
46
|
-
## Configuration
|
47
|
-
|
48
|
-
In order to communicate with vSphere, you must specify your user credentials. You can specify them in your `knife.rb` file:
|
49
|
-
|
50
|
-
```ruby
|
51
|
-
knife[:vcenter_username] = "myuser"
|
52
|
-
knife[:vcenter_password] = "mypassword"
|
53
|
-
knife[:vcenter_host] = "172.16.20.2"
|
54
|
-
knife[:vcenter_disable_ssl_verify] = true # if you want to disable SSL checking
|
55
|
-
```
|
56
|
-
|
57
|
-
or alternatively you can supply them on the command-line:
|
58
|
-
|
59
|
-
```bash
|
60
|
-
knife vcenter _command_ --vcenter-username myuser --vcenter-password mypassword
|
61
|
-
```
|
62
|
-
|
63
|
-
## Usage
|
64
|
-
|
65
|
-
### knife vcenter cluster list
|
66
|
-
|
67
|
-
Lists the clusters on the connected vSphere environment
|
68
|
-
|
69
|
-
```
|
70
|
-
$ knife vcenter cluster list
|
71
|
-
ID Name DRS? HA?
|
72
|
-
domain-c123 Cluster False False
|
73
|
-
```
|
74
|
-
|
75
|
-
## knife vcenter datacenter list
|
76
|
-
|
77
|
-
List the data centers configures in the vSPeher environment
|
78
|
-
|
79
|
-
```
|
80
|
-
$ knife vcenter datacenter list
|
81
|
-
ID Name
|
82
|
-
datacenter-21 Datacenter
|
83
|
-
```
|
84
|
-
|
85
|
-
## knife vcenter host list
|
86
|
-
|
87
|
-
List the hosts in the vSphere in the vSphere environment
|
88
|
-
|
89
|
-
```
|
90
|
-
$ knife vcenter host list
|
91
|
-
ID Name Power State Connection State
|
92
|
-
host-28 172.16.20.3 POWERED_ON CONNECTED
|
93
|
-
host-64 172.16.20.41 POWERED_ON CONNECTED
|
94
|
-
host-69 172.16.20.42 POWERED_ON CONNECTED
|
95
|
-
host-74 172.16.20.43 POWERED_ON CONNECTED
|
96
|
-
host-79 172.16.20.44 POWERED_ON CONNECTED
|
97
|
-
```
|
98
|
-
|
99
|
-
## knife vcenter vm list
|
100
|
-
|
101
|
-
List out all the virtual machines that exist in the vSphere environment
|
102
|
-
|
103
|
-
```
|
104
|
-
$ knife vcenter vm list
|
105
|
-
ID Name Power State CPU Count RAM Size (MB)
|
106
|
-
vm-42 alpine-docker POWERED_OFF 1 4,024
|
107
|
-
vm-35 automate-ubuntu POWERED_OFF 1 4,096
|
108
|
-
vm-44 chef POWERED_OFF 1 4,096
|
109
|
-
vm-33 chef-automate POWERED_OFF 1 4,096
|
110
|
-
vm-34 chef-buildnode POWERED_OFF 1 4,096
|
111
|
-
vm-43 chef-compliance POWERED_OFF 1 4,096
|
112
|
-
vm-71 CyberArk POWERED_OFF 1 8,192
|
113
|
-
vm-45 jenkins POWERED_ON 4 8,096
|
114
|
-
vm-36 LFS POWERED_OFF 2 4,096
|
115
|
-
```
|
116
|
-
|
117
|
-
## knife vcenter vm show NAME
|
118
|
-
|
119
|
-
Display details about a specific virtual machine.
|
120
|
-
|
121
|
-
```
|
122
|
-
$ knife vcenter vm show chef
|
123
|
-
ID: vm-44
|
124
|
-
Name: chef
|
125
|
-
Power State: POWERED_OFF
|
126
|
-
```
|
127
|
-
|
128
|
-
_The IP address of the machine is not returned yet as this requires a call to a different SDK_
|
129
|
-
|
130
|
-
## knife vcenter vm clone NAME
|
131
|
-
|
132
|
-
Create a new machine by cloning an existing machine or a template. This machine will be bootstrapped by Chef, as long as all the relevant details are in the `knife.rb` file.
|
133
|
-
|
134
|
-
The following parameters are required:
|
135
|
-
|
136
|
-
- `--datacenter` - Datacenter in the vSphere environment that controls the target host
|
137
|
-
- `--template` - Name of the virtual machine or template to use
|
138
|
-
|
139
|
-
There are some optional parameters that can be specified:
|
140
|
-
|
141
|
-
- `--targethost` - The host that the virtual machine should be created on. If not specified the first host in the cluster is used.
|
142
|
-
- `--folder` - Folder that machine should be stored in. If specified this must already exist.
|
143
|
-
|
144
|
-
```
|
145
|
-
$ knife vcenter vm clone example-01 --targethost 172.16.20.3 --folder example --ssh-password P@ssw0rd! --datacenter Datacenter --template ubuntu16-template -N example-01
|
146
|
-
Creating new machine
|
147
|
-
Waiting for network interfaces to become available...
|
148
|
-
ID: vm-183
|
149
|
-
Name: example-01
|
150
|
-
Power State: POWERED_ON
|
151
|
-
Bootstrapping the server by using bootstrap_protocol: ssh and image_os_type: linux
|
152
|
-
|
153
|
-
Waiting for sshd to host (10.0.0.167)
|
154
|
-
...
|
155
|
-
```
|
156
|
-
|
157
|
-
## knife vcenter vm delete NAME
|
158
|
-
|
159
|
-
Deletes a virtual machine from vSphere. If you supply `--purge` the machine will be removed from the Chef Server.
|
160
|
-
|
161
|
-
NOTE: If the node name is different to the host name then the `-N` argument must be specified in conjunction with the `--purge` option
|
162
|
-
|
163
|
-
```
|
164
|
-
$ knife vcenter vm delete example-01 -N example-01 --purge
|
165
|
-
Creating new machine
|
166
|
-
Waiting for network interfaces to become available...
|
167
|
-
ID: vm-183
|
168
|
-
Name: example-01
|
169
|
-
Power State: POWERED_ON
|
170
|
-
Bootstrapping the server by using bootstrap_protocol: ssh and image_os_type: linux
|
171
|
-
|
172
|
-
Waiting for sshd to host (10.0.0.167)
|
173
|
-
WARNING: Deleted node example-01
|
174
|
-
WARNING: Deleted client example-01
|
175
|
-
```
|
176
|
-
|
177
|
-
## Contributing
|
178
|
-
|
179
|
-
For information on contributing to this project see <https://github.com/chef/chef/blob/master/CONTRIBUTING.md>
|
180
|
-
|
181
|
-
## Development
|
182
|
-
|
183
|
-
* Report issues/questions/feature requests on [GitHub Issues][issues]
|
184
|
-
|
185
|
-
Pull requests are very welcome! Make sure your patches are well tested.
|
186
|
-
Ideally create a topic branch for every separate change you make. For
|
187
|
-
example:
|
188
|
-
|
189
|
-
1. Fork the repo
|
190
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
191
|
-
3. Run the tests and rubocop, `bundle exec rake spec` and `bundle exec rake rubocop`
|
192
|
-
4. Commit your changes (`git commit -am 'Added some feature'`)
|
193
|
-
5. Push to the branch (`git push origin my-new-feature`)
|
194
|
-
6. Create new Pull Request
|
195
|
-
|
196
|
-
|
197
|
-
## License
|
198
|
-
|
199
|
-
Author:: Russell Seymour ([rseymour@chef.io](mailto:rseymour@chef.io))
|
200
|
-
|
201
|
-
Author:: JJ Asghar ([jj@chef.io](mailto:jj@chef.io))
|
202
|
-
|
203
|
-
Copyright:: Copyright (c) 2017 Chef Software, Inc.
|
204
|
-
|
205
|
-
License:: Apache License, Version 2.0
|
206
|
-
|
207
|
-
```text
|
208
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
209
|
-
you may not use this file except in compliance with the License.
|
210
|
-
You may obtain a copy of the License at
|
211
|
-
|
212
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
213
|
-
|
214
|
-
Unless required by applicable law or agreed to in writing, software
|
215
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
216
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
217
|
-
See the License for the specific language governing permissions and
|
218
|
-
limitations under the License.
|
219
|
-
```
|