rake-proxmox 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e86b0404ad3fcc0965de8693897a4f295ec235da
4
+ data.tar.gz: 71ce3a0da918ad4f4b5f6c9ebfc64902809f91d5
5
+ SHA512:
6
+ metadata.gz: b316f59fdbfb1f5765a332cf335ff35f00a893ed6fa11333eb08c104243f5f3818b90e66c1407ca996d693934fe7d32c67ba062a5ec3d954417318b286581af6
7
+ data.tar.gz: 9f7d69532019380f9c7053bb93b9172de8d50136603eb25693d2b4c2f25d054038042a6f522d1a4712fdc8a239a5c132ff8ff5e60add79fe23b894696cef7554
data/.gitignore ADDED
@@ -0,0 +1,10 @@
1
+ /bin/
2
+ /.bundle/
3
+ /.yardoc
4
+ /Gemfile.lock
5
+ /_yardoc/
6
+ /coverage/
7
+ /doc/
8
+ /pkg/
9
+ /spec/reports/
10
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.rubocop.yml ADDED
@@ -0,0 +1,20 @@
1
+ AllCops:
2
+ Exclude:
3
+ - 'bin/**/*'
4
+ - 'files/**/*'
5
+ - 'vendor/**/*'
6
+ - 'config/**/*'
7
+ - Gemfile
8
+ DefaultFormatter: progress
9
+ DisplayStyleGuide: true
10
+ StyleGuideBaseURL: https://github.com/bbatsov/ruby-style-guide
11
+ ExtraDetails: true
12
+
13
+ Metrics/BlockLength:
14
+ Enabled: false
15
+
16
+ Metrics/ModuleLength:
17
+ Enabled: false
18
+
19
+ Metrics/MethodLength:
20
+ Enabled: false
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.3.1
5
+ before_install: gem install bundler -v 1.13.7
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at lehn@etracker.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in rake-proxmox.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Sebastian Lehn
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,59 @@
1
+ # Rake::Proxmox
2
+
3
+ Inspired by [nledez/proxmox](https://github.com/nledez/proxmox)
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'rake-proxmox'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install rake-proxmox
20
+
21
+ Put following block in your `Rakefile`
22
+
23
+ ```ruby
24
+ Rake::Proxmox::RakeTasks.new
25
+ ```
26
+
27
+ ## Usage
28
+
29
+ Export needed environment variables to define which Proxmox cluster will be
30
+ used.
31
+
32
+ ```bash
33
+ export PROXMOX_PVE_CLUSTER=https://pve1.example.com:8006/api2/json/
34
+ export PROXMOX_NODE=pve1
35
+ export PROXMOX_REALM=pve
36
+ export PROXMOX_USERNAME=vagrant
37
+ export PROXMOX_PASSWORD=vagrant
38
+ ```
39
+
40
+ Now, list all available tasks by calling
41
+
42
+ ```bash
43
+ rake -T
44
+ ```
45
+
46
+ ## Development
47
+
48
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
49
+
50
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
51
+
52
+ ## Contributing
53
+
54
+ Bug reports and pull requests are welcome on GitHub at https://github.com/lehn-etracker/rake-proxmox. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
55
+
56
+
57
+ ## License
58
+
59
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "rake/proxmox"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,528 @@
1
+ require 'rest_client'
2
+ require 'json'
3
+
4
+ module Rake
5
+ module Proxmox
6
+ # ProxmoxApi adopted from https://github.com/nledez/proxmox
7
+ # rubocop:disable Metrics/ClassLength
8
+ class ProxmoxApi
9
+ # Return connection status
10
+ # - connected
11
+ # - error
12
+ attr_reader :connection_status
13
+
14
+ # Create a object to manage a Proxmox server through API
15
+ #
16
+ # :call-seq:
17
+ # new(pve_cluster, node, username, password, realm, ssl_options)
18
+ # -> Proxmox
19
+ #
20
+ # Example:
21
+ #
22
+ # Proxmox::Proxmox.new('https://the-proxmox-server:8006/api2/json/',
23
+ # 'node', 'root', 'secret', 'pam',
24
+ # {verify_ssl: false})
25
+ #
26
+ # rubocop:disable Metrics/ParameterLists
27
+ def initialize(pve_cluster, node, username, password, realm,
28
+ ssl_options = {})
29
+ @pve_cluster = pve_cluster
30
+ @node = node
31
+ @username = username
32
+ @password = password
33
+ @realm = realm
34
+ @ssl_options = ssl_options
35
+ @connection_status = 'error'
36
+ @site = RestClient::Resource.new(@pve_cluster, @ssl_options)
37
+ @auth_params = create_ticket
38
+ end
39
+
40
+ def get(path, args = {})
41
+ http_action_get(path, args)
42
+ end
43
+
44
+ def post(path, args = {})
45
+ http_action_post(path, args)
46
+ end
47
+
48
+ def put(path, args = {})
49
+ http_action_put(path, args)
50
+ end
51
+
52
+ def delete(path)
53
+ http_action_delete(path)
54
+ end
55
+
56
+ # Get task status
57
+ #
58
+ # :call-seq:
59
+ # task_status(task-id) -> String
60
+ #
61
+ # - taksstatus
62
+ # - taskstatus:exitstatus
63
+ #
64
+ # Example:
65
+ #
66
+ # taskstatus \
67
+ # 'UPID:localhost:00051DA0:119EAABC:521CCB19:vzcreate:203:root@pam:'
68
+ #
69
+ # Examples return:
70
+ # - running
71
+ # - stopped:OK
72
+ #
73
+ def task_status(upid, node = @node)
74
+ data = http_action_get "nodes/#{node}/tasks/#{URI.encode upid}/status"
75
+ status = data['status']
76
+ exitstatus = data['exitstatus']
77
+ if exitstatus
78
+ "#{status}:#{exitstatus}"
79
+ else
80
+ status.to_s
81
+ end
82
+ end
83
+
84
+ # get task log
85
+ def task_log(upid, node = @node, start = 0, limit = 20)
86
+ data = {
87
+ start: start,
88
+ limit: limit
89
+ }
90
+ http_action_get("nodes/#{node}/tasks/#{URI.encode upid}/log", data)
91
+ end
92
+
93
+ # Get template list
94
+ #
95
+ # :call-seq:
96
+ # templates -> Hash
97
+ #
98
+ # Return a Hash of all templates
99
+ #
100
+ # Example:
101
+ #
102
+ # templates
103
+ #
104
+ # Example return:
105
+ #
106
+ # {
107
+ # 'ubuntu-10.04-standard_10.04-4_i386' => {
108
+ # 'format' => 'tgz',
109
+ # 'content' => 'vztmpl',
110
+ # 'volid' => 'local:vztmpl/ubuntu-10.04-...d_10.04-4_i386.tar.gz',
111
+ # 'size' => 142126884
112
+ # },
113
+ # 'ubuntu-12.04-standard_12.04-1_i386' => {
114
+ # 'format' => 'tgz',
115
+ # 'content' => 'vztmpl',
116
+ # 'volid' => 'local:vztmpl/ubuntu-12.04-...d_12.04-1_i386.tar.gz',
117
+ # 'size' => 130040792
118
+ # }
119
+ # }
120
+ #
121
+ def templates
122
+ data = http_action_get "nodes/#{@node}/storage/local/content"
123
+ template_list = {}
124
+ data.each do |ve|
125
+ name = ve['volid'].gsub(%r{local:vztmpl\/(.*).tar.gz}, '\1')
126
+ template_list[name] = ve
127
+ end
128
+ template_list
129
+ end
130
+
131
+ # Get CT list
132
+ #
133
+ # :call-seq:
134
+ # lxc_get -> Hash
135
+ #
136
+ # Return a Hash of all lxc container
137
+ #
138
+ # Example:
139
+ #
140
+ # lxc_get
141
+ #
142
+ # Example return:
143
+ # {
144
+ # '101' => {
145
+ # 'maxswap' => 536870912,
146
+ # 'disk' => 405168128,
147
+ # 'ip' => '192.168.1.5',
148
+ # 'status' => 'running',
149
+ # 'netout' => 272,
150
+ # 'maxdisk' => 4294967296,
151
+ # 'maxmem' => 536870912,
152
+ # 'uptime' => 3068073,
153
+ # 'swap' => 0,
154
+ # 'vmid' => '101',
155
+ # 'nproc' => '10',
156
+ # 'diskread' => 0,
157
+ # 'cpu' => 0.00031670581100007,
158
+ # 'netin' => 0,
159
+ # 'name' => 'test2.domain.com',
160
+ # 'failcnt' => 0,
161
+ # 'diskwrite' => 0,
162
+ # 'mem' => 22487040,
163
+ # 'type' => 'lxc',
164
+ # 'cpus' => 1
165
+ # },
166
+ # [...]
167
+ # }
168
+ def lxc_get(node = @node)
169
+ data = http_action_get "nodes/#{node}/lxc"
170
+ ve_list = {}
171
+ data.each do |ve|
172
+ ve_list[ve['vmid']] = ve
173
+ end
174
+ ve_list
175
+ end
176
+
177
+ # Create CT container
178
+ #
179
+ # :call-seq:
180
+ # lxc_post(ostemplate, vmid) -> String
181
+ # lxc_post(ostemplate, vmid, options) -> String
182
+ #
183
+ # Return a String as task ID
184
+ #
185
+ # Examples:
186
+ #
187
+ # lxc_post('ubuntu-10.04-standard_10.04-4_i386', 200)
188
+ # lxc_post('ubuntu-10.04-standard_10.04-4_i386', 200, \
189
+ # {'hostname' => 'test.test.com', 'password' => 'testt' })
190
+ #
191
+ # Example return:
192
+ #
193
+ # UPID:localhost:000BC66A:1279E395:521EFC4E:vzcreate:200:root@pam:
194
+ #
195
+ def lxc_post(ostemplate, vmid, config = {}, node = @node)
196
+ config['vmid'] = vmid
197
+ config['ostemplate'] = ostemplate
198
+ vm_definition = config.to_a.map { |v| v.join '=' }.join '&'
199
+
200
+ http_action_post("nodes/#{node}/lxc", vm_definition)
201
+ end
202
+
203
+ # Delete CT
204
+ #
205
+ # :call-seq:
206
+ # lxc_delete(vmid) -> String
207
+ #
208
+ # Return a string as task ID
209
+ #
210
+ # Example:
211
+ #
212
+ # lxc_delete(200)
213
+ #
214
+ # Example return:
215
+ #
216
+ # UPID:localhost:000BC66A:1279E395:521EFC4E:vzdelete:200:root@pam:
217
+ #
218
+ def lxc_delete(vmid, node = @node)
219
+ http_action_delete "nodes/#{node}/lxc/#{vmid}"
220
+ end
221
+
222
+ # Get CT status
223
+ #
224
+ # :call-seq:
225
+ # lxc_delete(vmid) -> String
226
+ #
227
+ # Return a string as task ID
228
+ #
229
+ # Example:
230
+ #
231
+ # lxc_delete(200)
232
+ #
233
+ # Example return:
234
+ #
235
+ # UPID:localhost:000BC66A:1279E395:521EFC4E:vzdelete:200:root@pam:
236
+ #
237
+ def lxc_status(vmid, node = @node)
238
+ http_action_get "nodes/#{node}/lxc/#{vmid}/status/current"
239
+ end
240
+
241
+ # Start CT
242
+ #
243
+ # :call-seq:
244
+ # lxc_start(vmid) -> String
245
+ #
246
+ # Return a string as task ID
247
+ #
248
+ # Example:
249
+ #
250
+ # lxc_start(200)
251
+ #
252
+ # Example return:
253
+ #
254
+ # UPID:localhost:000BC66A:1279E395:521EFC4E:vzstart:200:root@pam:
255
+ #
256
+ def lxc_start(vmid, node = @node)
257
+ http_action_post "nodes/#{node}/lxc/#{vmid}/status/start"
258
+ end
259
+
260
+ # Stop CT
261
+ #
262
+ # :call-seq:
263
+ # lxc_stop(vmid) -> String
264
+ #
265
+ # Return a string as task ID
266
+ #
267
+ # Example:
268
+ #
269
+ # lxc_stop(200)
270
+ #
271
+ # Example return:
272
+ #
273
+ # UPID:localhost:000BC66A:1279E395:521EFC4E:vzstop:200:root@pam:
274
+ #
275
+ def lxc_stop(vmid, node = @node)
276
+ http_action_post "nodes/#{node}/lxc/#{vmid}/status/stop"
277
+ end
278
+
279
+ # Shutdown CT
280
+ #
281
+ # :call-seq:
282
+ # lxc_shutdown(vmid) -> String
283
+ #
284
+ # Return a string as task ID
285
+ #
286
+ # Example:
287
+ #
288
+ # lxc_shutdown(200)
289
+ #
290
+ # Example return:
291
+ #
292
+ # UPID:localhost:000BC66A:1279E395:521EFC4E:vzshutdown:200:root@pam:
293
+ #
294
+ def lxc_shutdown(vmid, node = @node)
295
+ http_action_post "nodes/#{node}/lxc/#{vmid}/status/shutdown"
296
+ end
297
+
298
+ # Get CT config
299
+ #
300
+ # :call-seq:
301
+ # lxc_config(vmid) -> String
302
+ #
303
+ # Return a string as task ID
304
+ #
305
+ # Example:
306
+ #
307
+ # lxc_config(200)
308
+ #
309
+ # Example return:
310
+ #
311
+ # {
312
+ # 'quotaugidlimit' => 0,
313
+ # 'disk' => 0,
314
+ # 'ostemplate' => 'ubuntu-10.04-standard_10.04-4_i386.tar.gz',
315
+ # 'hostname' => 'test.test.com',
316
+ # 'nameserver' => '127.0.0.1 192.168.1.1',
317
+ # 'memory' => 256,
318
+ # 'searchdomain' => 'domain.com',
319
+ # 'onboot' => 0,
320
+ # 'cpuunits' => 1000,
321
+ # 'swap' => 256,
322
+ # 'quotatime' => 0,
323
+ # 'digest' => 'e7e6e21a215af6b9da87a8ecb934956b8983f960',
324
+ # 'cpus' => 1,
325
+ # 'storage' => 'local'
326
+ # }
327
+ #
328
+ def lxc_config(vmid, node = @node)
329
+ http_action_get "nodes/#{node}/lxc/#{vmid}/config"
330
+ end
331
+
332
+ # Set CT config
333
+ #
334
+ # :call-seq:
335
+ # lxc_config_set(vmid, parameters) -> Nil
336
+ #
337
+ # Return nil
338
+ #
339
+ # Example:
340
+ #
341
+ # lxc_config(200, { 'swap' => 2048 })
342
+ #
343
+ # Example return:
344
+ #
345
+ # nil
346
+ #
347
+ def lxc_config_set(vmid, data, node = @node)
348
+ http_action_put("nodes/#{node}/lxc/#{vmid}/config", data)
349
+ end
350
+
351
+ # LXC snapshot
352
+ def lxc_snapshot(vmid, snapname, desc, node = @node)
353
+ data = {
354
+ snapname: snapname,
355
+ description: desc
356
+ }
357
+ http_action_post("nodes/#{node}/lxc/#{vmid}/snapshot", data)
358
+ end
359
+
360
+ # LXC snapshot list
361
+ def lxc_snapshot_list(vmid, node = @node)
362
+ http_action_get("nodes/#{node}/lxc/#{vmid}/snapshot")
363
+ end
364
+
365
+ # LXC snapshot delete
366
+ def lxc_snapshot_delete(vmid, snapname, node = @node)
367
+ http_action_delete("nodes/#{node}/lxc/#{vmid}/snapshot/#{snapname}")
368
+ end
369
+
370
+ # Get VM list
371
+ def qemu_get
372
+ data = http_action_get "nodes/#{@node}/qemu"
373
+ ve_list = {}
374
+ data.each do |ve|
375
+ ve_list[ve['vmid']] = ve
376
+ end
377
+ ve_list
378
+ end
379
+
380
+ # Create VM container
381
+ def qemu_post(template, vmid, config = {})
382
+ config['vmid'] = vmid
383
+ config['template'] = "local%3Aisol%2F#{template}.iso"
384
+ config['kvm'] = 1
385
+ vm_definition = config.to_a.map { |v| v.join '=' }.join '&'
386
+
387
+ http_action_post("nodes/#{@node}/qemu", vm_definition)
388
+ end
389
+
390
+ # Delete VM
391
+ def qemu_delete(vmid)
392
+ http_action_delete "nodes/#{@node}/qemu/#{vmid}"
393
+ end
394
+
395
+ # Get VM status
396
+ def qemu_status(vmid)
397
+ http_action_get "nodes/#{@node}/qemu/#{vmid}/status/current"
398
+ end
399
+
400
+ # Start VM
401
+ def qemu_start(vmid)
402
+ http_action_post "nodes/#{@node}/qemu/#{vmid}/status/start"
403
+ end
404
+
405
+ # Stop VM
406
+ def qemu_stop(vmid)
407
+ http_action_post "nodes/#{@node}/qemu/#{vmid}/status/stop"
408
+ end
409
+
410
+ # Shutdown VM
411
+ def qemu_shutdown(vmid)
412
+ http_action_post "nodes/#{@node}/qemu/#{vmid}/status/shutdown"
413
+ end
414
+
415
+ # Get VM config
416
+ def qemu_config(vmid)
417
+ http_action_get "nodes/#{@node}/qemu/#{vmid}/config"
418
+ end
419
+
420
+ # Set VM config
421
+ def qemu_config_set(vmid, data)
422
+ http_action_put("nodes/#{@node}/qemu/#{vmid}/config", data)
423
+ end
424
+
425
+ # cluster Methods
426
+ def cluster_resources_get(type)
427
+ http_action_get("cluster/resources?type=#{type}")
428
+ end
429
+
430
+ # Backup VM
431
+ def vzdump_single(vmid, node = @node, storage = 'local',
432
+ mode = 'snapshot', compress = 1, remove = 1, pigz = 1,
433
+ lockwait = 5)
434
+ data = {
435
+ all: 0,
436
+ compress: compress,
437
+ storage: storage,
438
+ remove: remove,
439
+ pigz: pigz,
440
+ mode: mode,
441
+ lockwait: lockwait,
442
+ vmid: vmid
443
+ }
444
+ http_action_post("nodes/#{node}/vzdump", data)
445
+ end
446
+
447
+ # list storage
448
+ def list_storage(node = @node, storage = 'local')
449
+ http_action_get("nodes/#{node}/storage/#{storage}/content")
450
+ end
451
+
452
+ # upload lxc template
453
+ def upload_template(filename, node = @node, storage = 'local')
454
+ "Template #{filename} does not exist locally" unless File.file? filename
455
+ data = {
456
+ content: 'vztmpl',
457
+ filename: File.new(filename)
458
+ }
459
+ http_action_post("nodes/#{node}/storage/#{storage}/upload", data)
460
+ end
461
+
462
+ private
463
+
464
+ # Methods manages auth
465
+ def create_ticket
466
+ post_param = { username: @username, realm: @realm, password: @password }
467
+ @site['access/ticket'].post post_param do |resp, _req, _res, &_block|
468
+ if resp.code == 200
469
+ extract_ticket resp
470
+ else
471
+ @connection_status = 'error'
472
+ end
473
+ end
474
+ end
475
+
476
+ # Method create ticket
477
+ def extract_ticket(response)
478
+ data = JSON.parse(response.body)
479
+ ticket = data['data']['ticket']
480
+ csrf_prevention_token = data['data']['CSRFPreventionToken']
481
+ unless ticket.nil?
482
+ token = 'PVEAuthCookie=' + ticket.gsub!(/:/, '%3A').gsub!(/=/, '%3D')
483
+ end
484
+ @connection_status = 'connected'
485
+ {
486
+ CSRFPreventionToken: csrf_prevention_token,
487
+ cookie: token
488
+ }
489
+ end
490
+
491
+ # Extract data or return error
492
+ def check_response(response)
493
+ if response.code == 200
494
+ JSON.parse(response.body)['data']
495
+ else
496
+ 'NOK: error code = ' + response.code.to_s \
497
+ + 'data = ' + response.body + "\n"
498
+ end
499
+ end
500
+
501
+ # Methods manage http dialogs
502
+ def http_action_post(url, data = {})
503
+ # print "POST #{url}\n#{data}\n"
504
+ @site[url].post data, @auth_params do |resp, _req, _res, &_block|
505
+ check_response resp
506
+ end
507
+ end
508
+
509
+ def http_action_put(url, data = {})
510
+ @site[url].put data, @auth_params do |resp, _req, _res, &_block|
511
+ check_response resp
512
+ end
513
+ end
514
+
515
+ def http_action_get(url, data = {})
516
+ @site[url].get @auth_params.merge(data) do |resp, _req, _res, &_block|
517
+ check_response resp
518
+ end
519
+ end
520
+
521
+ def http_action_delete(url)
522
+ @site[url].delete @auth_params do |resp, _req, _res, &_block|
523
+ check_response resp
524
+ end
525
+ end
526
+ end
527
+ end
528
+ end
@@ -0,0 +1,5 @@
1
+ module Rake
2
+ module Proxmox
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,393 @@
1
+ require 'rake/proxmox/version'
2
+ require 'rake/proxmox/proxmox_api'
3
+ require 'rake/tasklib'
4
+
5
+ module Rake
6
+ module Proxmox
7
+ # This class provides rake tasks to control proxmox cluster through api.
8
+ #
9
+ # rubocop:disable Metrics/ClassLength
10
+ class RakeTasks < ::Rake::TaskLib
11
+ # @yield [self] gives itself to the block
12
+ # rubocop:disable Metrics/AbcSize
13
+ def initialize(ssl_options = {})
14
+ unless ENV.include?('PROXMOX_PVE_CLUSTER')
15
+ puts ''
16
+ puts '# Proxmox Tasks are not available without correct environment'
17
+ puts '#'
18
+ puts '# Please set following variables to enable that feature:'
19
+ puts '#'
20
+ puts '# export PROXMOX_PVE_CLUSTER='\
21
+ 'https://pve1.example.com:8006/api2/json/'
22
+ puts '# export PROXMOX_NODE=pve1'
23
+ puts '# export PROXMOX_REALM=pve'
24
+ puts '# export PROXMOX_USERNAME=vagrant'
25
+ puts '# export PROXMOX_PASSWORD=vagrant'
26
+ puts ''
27
+ return false
28
+ end
29
+
30
+ @proxmox = Rake::Proxmox::ProxmoxApi.new(
31
+ ENV['PROXMOX_PVE_CLUSTER'],
32
+ ENV['PROXMOX_NODE'],
33
+ ENV['PROXMOX_USERNAME'],
34
+ ENV['PROXMOX_PASSWORD'],
35
+ ENV['PROXMOX_REALM'],
36
+ ssl_options
37
+ )
38
+
39
+ # container for current lxc status
40
+ @lxc_status = {}
41
+
42
+ yield self if block_given?
43
+ define
44
+ end
45
+
46
+ # @return [Proxmox] a Proxmox::Proxmox
47
+ attr_reader :proxmox
48
+
49
+ # @return [Hash] from Proxmox.lxc_get
50
+ attr_accessor :lxc_status
51
+
52
+ private
53
+
54
+ def update_lxc_status
55
+ # self.lxc_status = proxmox.lxc_get
56
+ proxmox.cluster_resources_get('vm').each do |vm|
57
+ # print "vm: #{vm}\n"
58
+ # print "vm: #{vm['name']} on #{vm['node']}\n"
59
+ next unless vm.include?('type')
60
+ next unless vm.include?('vmid')
61
+ next unless vm['type'] <=> 'lxc'
62
+ lxc_status[vm['vmid']] = vm
63
+ end
64
+ # print lxc_status
65
+ end
66
+
67
+ def wait_for_task(upid, node = nil)
68
+ max_n = 0
69
+ if upid.include?('NOK: error code')
70
+ print "Proxmox task failed #{upid}"
71
+ l = proxmox.task_log(upid, node, max_n)
72
+ return false unless l.is_a?(Array)
73
+ l.each do |log_entry|
74
+ next if log_entry['n'].to_i <= max_n
75
+ print "[#{log_entry['n']}] #{log_entry['t']}\n"
76
+ max_n = log_entry['n'].to_i
77
+ end
78
+ return false
79
+ end
80
+ status = proxmox.task_status(upid, node)
81
+ until status.include? ':'
82
+ sleep 1
83
+ print "waiting for task: '#{upid}' [#{status}]\n"
84
+ proxmox.task_log(upid, node, max_n).each do |log_entry|
85
+ next if log_entry['n'].to_i <= max_n
86
+ print "[#{log_entry['n']}] #{log_entry['t']}\n"
87
+ max_n = log_entry['n'].to_i
88
+ end
89
+ status = proxmox.task_status(upid, node)
90
+ end
91
+ (_final_status, exitstatus) = status.split(':')
92
+ if exitstatus.include?('OK')
93
+ print "waiting for task: '#{upid}' [#{exitstatus}]\n"
94
+ return true
95
+ end
96
+ proxmox.task_log(upid, node, max_n).each do |log_entry|
97
+ next if log_entry['n'].to_i <= max_n
98
+ print "[#{log_entry['n']}] #{log_entry['t']}\n"
99
+ max_n = log_entry['n'].to_i
100
+ end
101
+ print "waiting for task failed: '#{upid}' [#{exitstatus}]\n"
102
+ false
103
+ end
104
+
105
+ def lxc_stop(vmid)
106
+ prop = lxc_status[vmid]
107
+ return false unless prop.include?('status')
108
+ return false unless prop.include?('node')
109
+ return true if prop['status'].include?('stopped')
110
+ print "stopping CT #{vmid} (#{prop['name']})\n"
111
+ taskid = proxmox.lxc_stop(vmid, prop['node'])
112
+ wait_for_task(taskid, prop['node'])
113
+ end
114
+
115
+ def lxc_destroy(vmid)
116
+ prop = lxc_status[vmid]
117
+ return false unless prop.include?('name')
118
+ return false unless prop.include?('node')
119
+ print "destroy CT #{vmid} (#{prop['name']})\n"
120
+ taskid = proxmox.lxc_delete(vmid, prop['node'])
121
+ wait_for_task(taskid, prop['node'])
122
+ end
123
+
124
+ def lxc_snapshot(vmid, name, desc)
125
+ prop = lxc_status[vmid]
126
+ return false unless prop.include?('status')
127
+ return false unless prop.include?('node')
128
+ print "snapshot vmid: #{vmid} (#{prop['name']})\n"
129
+ taskid = proxmox.lxc_snapshot(vmid, name, desc, prop['node'])
130
+ wait_for_task(taskid, prop['node'])
131
+ end
132
+
133
+ def lxc_snapshot_list(vmid)
134
+ prop = lxc_status[vmid]
135
+ return false unless prop.include?('status')
136
+ return false unless prop.include?('node')
137
+ # print "snapshot list vmid: #{vmid} (#{prop['name']})\n"
138
+ l = proxmox.lxc_snapshot_list(vmid, prop['node'])
139
+ return false if l.is_a?(String)
140
+ l
141
+ end
142
+
143
+ def lxc_snapshot_delete(vmid, snapname)
144
+ prop = lxc_status[vmid]
145
+ return false unless prop.include?('status')
146
+ return false unless prop.include?('node')
147
+ print "snapshot delete #{snapname} vmid: #{vmid} (#{prop['name']})\n"
148
+ taskid = proxmox.lxc_snapshot_delete(vmid, snapname, prop['node'])
149
+ wait_for_task(taskid, prop['node'])
150
+ end
151
+
152
+ def lxc_backup(vmid, storage, mode = 'snapshot')
153
+ prop = lxc_status[vmid]
154
+ return false unless prop.include?('status')
155
+ return false unless prop.include?('node')
156
+ print "vzdump to #{storage} vmid: #{vmid} (#{prop['name']})\n"
157
+ taskid = proxmox.vzdump_single(vmid, prop['node'], storage, mode)
158
+ wait_for_task(taskid, prop['node'])
159
+ end
160
+
161
+ def lxc_restore(vmid, storage, backup_storage, backup, node = nil)
162
+ options = {
163
+ force: 1,
164
+ restore: 1,
165
+ storage: storage
166
+ }
167
+ prop = if node
168
+ p = {}
169
+ p['status'] = 'to-be-recovered'
170
+ p['node'] = node.to_s
171
+ # return p into prop
172
+ p
173
+ else
174
+ lxc_status[vmid]
175
+ end
176
+ return false unless prop.include?('status')
177
+ return false unless prop.include?('node')
178
+ put "vzrestore of #{storage}:#{file} to vmid: #{vmid} (#{prop['name']})"
179
+ taskid = proxmox.lxc_post("#{backup_storage}:#{backup}", vmid, options,
180
+ prop['node'])
181
+ wait_for_task(taskid, prop['node'])
182
+ end
183
+
184
+ # define Rake tasks
185
+ def define
186
+ desc 'Proxmox'
187
+ update_lxc_status
188
+ namespace 'proxmox' do
189
+ desc 'upload template to proxmox storage'
190
+ task 'storage:upload:template', %i[filename node storage] \
191
+ do |_t, args|
192
+ args.with_defaults(storage: 'local')
193
+ args.with_defaults(node: ENV['PROXMOX_NODE'])
194
+ # get upload filename
195
+ upload_file_split = File.split(args.filename)
196
+ upload_filename = upload_file_split[1]
197
+ # validate file does not already exist
198
+ should_i_upload = true
199
+ proxmox.list_storage(args.node, args.storage).each do |c|
200
+ (_c_storage, c_path) = c['volid'].split(':')
201
+ (_c_content, c_name) = c_path.split('/')
202
+ next unless c_name == upload_filename
203
+ puts "Template #{upload_filename} already on server"
204
+ should_i_upload = false
205
+ break
206
+ end
207
+ if should_i_upload
208
+ puts "upload template: #{args.filename} to #{args.storage}@#{args.node}:\n"
209
+ r = proxmox.upload_template(args.filename, args.node,
210
+ args.storage)
211
+ puts "upload result: #{r}"
212
+ end
213
+ end
214
+
215
+ desc 'list proxmox storage'
216
+ task 'storage:list', %i[node storage] do |_t, args|
217
+ args.with_defaults(storage: 'local')
218
+ args.with_defaults(node: ENV['PROXMOX_NODE'])
219
+ print "list_storage: #{args.storage}@#{args.node}:\n"
220
+ proxmox.list_storage(args.node, args.storage).each do |c|
221
+ print " content:#{c['content']} volid:#{c['volid']}\n"
222
+ end
223
+ end
224
+
225
+ desc 'list proxmox backups'
226
+ task 'backup:list', %i[vmid node storage] do |_t, args|
227
+ args.with_defaults(storage: 'local')
228
+ args.with_defaults(node: ENV['PROXMOX_NODE'])
229
+ $stderr.puts "backup list vmid:#{args.vmid} #{args.storage}@"\
230
+ "#{args.node}:"
231
+ proxmox.list_storage(args.node, args.storage).each do |c|
232
+ # print " content:#{c['content']} volid:#{c['volid']}\n"
233
+ filename_parts = c['volid'].split('/')[1].split('.')[0].split('-')
234
+ next if filename_parts.count < 4
235
+ next if filename_parts[1].empty?
236
+ next unless filename_parts[1] <=> 'lxc' # must be lxc type
237
+ # get vmid of backup
238
+ file_vmid = filename_parts[2].to_i
239
+ next unless file_vmid.to_s == filename_parts[2]
240
+ next unless file_vmid == args.vmid.to_i
241
+ print "#{c['volid']}\n"
242
+ end
243
+ end
244
+
245
+ desc 'restore from vzdump [:vmid, :node'\
246
+ " :storage => 'local',"\
247
+ " :backup_storage => 'local',"\
248
+ ' :file]'
249
+ task 'backup:restore', %i[vmid
250
+ node
251
+ storage
252
+ backup_storage
253
+ file] do |_t, args|
254
+ print "restore args: #{args}\n"
255
+ id = args.vmid.to_i
256
+ args.with_defaults(storage: 'local')
257
+ args.with_defaults(backup_storage: 'local')
258
+ unless lxc_restore(id, args.storage, args.backup_storage,
259
+ args.file, args.node)
260
+ raise "failed to restore #{id} from "\
261
+ "#{args.storage}:#{args.file} to #{args.storage}\n"
262
+ end
263
+ end
264
+
265
+ desc 'destroy all but exclude_ids (defaulting to: 6002) separated by'\
266
+ ' colon(:)'
267
+ task 'destroy:all', %i[exclude_ids delete_low_ids] do |t, args|
268
+ args.with_defaults(exclude_ids: '6002')
269
+ args.with_defaults(delete_low_ids: 'false')
270
+ exclude_ids = args.exclude_ids.split(':').map(&:to_i)
271
+ b = { 'true' => true,
272
+ true => true,
273
+ 'false' => false,
274
+ false => false }
275
+ low_ids = b[args.delete_low_ids.downcase]
276
+ print "exclude_ids: #{exclude_ids}\n"
277
+
278
+ return false unless lxc_status
279
+
280
+ lxc_status.each do |id, prop|
281
+ next if exclude_ids.include?(id.to_i)
282
+ if !low_ids && id.to_i < 6000
283
+ raise "not allowed to destroy id: #{id} < low_ids (6000)"\
284
+ " enable delete_low_ids deletion by executing \n"\
285
+ "# rake #{t}[#{args.exclude_ids},true]"
286
+ end
287
+ unless lxc_stop(id)
288
+ raise "failed to stop #{id} (#{prop['name']})\n"
289
+ end
290
+ unless lxc_destroy(id)
291
+ raise "failed to destroy #{id} (#{prop['name']})\n"
292
+ end
293
+ end
294
+ end
295
+ # create snapshot of every container
296
+ desc 'snapshot all but exclude_ids (defaulting to: 6002) separated'\
297
+ ' by colon(:)'
298
+ task 'snapshot:create:all', %i[exclude_ids name desc] do |_t, args|
299
+ args.with_defaults(exclude_ids: '6002')
300
+ args.with_defaults(name: 'rakesnap1')
301
+ args.with_defaults(desc: 'snapshot taken by rake task')
302
+ exclude_ids = args.exclude_ids.split(':').map(&:to_i)
303
+ print "exclude_ids: #{exclude_ids}\n"
304
+
305
+ return false unless lxc_status
306
+
307
+ lxc_status.each do |id, prop|
308
+ next if exclude_ids.include?(id.to_i)
309
+ unless lxc_snapshot(id, args.name, args.desc)
310
+ raise "failed to snapshot #{id} (#{prop['name']})\n"
311
+ end
312
+ end
313
+ end
314
+ # delete all snapshots with specific name
315
+ desc 'delete all snapshots with :name'
316
+ task 'snapshot:delete:all', %i[exclude_ids name] do |_t, args|
317
+ args.with_defaults(exclude_ids: '6002')
318
+ args.with_defaults(name: 'rakesnap1')
319
+ exclude_ids = args.exclude_ids.split(':').map(&:to_i)
320
+ print "exclude_ids: #{exclude_ids}\n"
321
+
322
+ return false unless lxc_status
323
+
324
+ lxc_status.each do |id, prop|
325
+ next if exclude_ids.include?(id.to_i)
326
+ unless lxc_snapshot_delete(id, args.name)
327
+ raise "failed to delete snapshot #{snap['name']} from #{id} "\
328
+ "(#{prop['name']})\n"
329
+ end
330
+ end
331
+ end
332
+ # add task for each lxc container
333
+ lxc_status.each do |id, prop|
334
+ desc "destroy #{prop['name']}"
335
+ task "destroy:#{prop['name']}" do
336
+ unless lxc_stop(id)
337
+ raise "failed to stop #{id} (#{prop['name']})\n"
338
+ end
339
+ unless lxc_destroy(id)
340
+ raise "failed to destroy #{id} (#{prop['name']})\n"
341
+ end
342
+ end
343
+ desc "backup #{prop['name']} [:storage => 'local',"\
344
+ " :mode => 'snapshot']"
345
+ task "backup:create:#{prop['name']}", %i[storage mode] do |_t, args|
346
+ args.with_defaults(storage: 'local')
347
+ args.with_defaults(mode: 'snapshot')
348
+ unless lxc_backup(id, args.storage, args.mode)
349
+ raise "failed to backup #{id} (#{prop['name']})\n"
350
+ end
351
+ end
352
+ desc "restore #{prop['name']} [:storage => 'local',"\
353
+ ' :file]'
354
+ task "backup:restore:#{prop['name']}", %i[storage
355
+ backup_storage
356
+ file] do |_t, args|
357
+ args.with_defaults(storage: 'local')
358
+ args.with_defaults(backup_storage: 'local')
359
+ unless lxc_restore(id, args.storage, args.backup_storage,
360
+ args.file)
361
+ raise "failed to restore #{id} (#{prop['name']}) from "\
362
+ "#{args.storage}:#{args.file} to #{args.storage}\n"
363
+ end
364
+ end
365
+ desc "snapshot #{prop['name']}"
366
+ task "snapshot:create:#{prop['name']}", %i[name desc] do |_t, args|
367
+ args.with_defaults(name: 'rakesnap1')
368
+ args.with_defaults(desc: 'snapshot taken by rake task')
369
+ unless lxc_snapshot(id, args.name, args.desc)
370
+ raise "failed to snapshot #{id} (#{prop['name']})\n"
371
+ end
372
+ end
373
+ lxc_snap_list = lxc_snapshot_list(id)
374
+ next if lxc_snap_list == false
375
+ lxc_snap_list.each do |snap|
376
+ next unless snap.include?('name')
377
+ next if snap['name'] == 'current'
378
+ desc "snapshot #{snap['name']} from #{prop['name']} "\
379
+ "(#{snap['description'].tr("\n", ' ').gsub(/ $/, '')})"
380
+ task "snapshot:delete:#{prop['name']}:#{snap['name']}"\
381
+ do |_t, _args|
382
+ unless lxc_snapshot_delete(id, snap['name'])
383
+ raise "failed to delete snapshot #{snap['name']} of #{id}"\
384
+ " (#{prop['name']})\n"
385
+ end
386
+ end
387
+ end
388
+ end
389
+ end
390
+ end
391
+ end
392
+ end
393
+ end
@@ -0,0 +1,39 @@
1
+ # coding: utf-8
2
+
3
+ lib = File.expand_path('../lib', __FILE__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require 'rake/proxmox/version'
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = 'rake-proxmox'
9
+ spec.version = Rake::Proxmox::VERSION
10
+ spec.authors = ['Sebastian Lehn']
11
+ spec.email = ['lehn@etracker.com']
12
+
13
+ spec.summary = 'Provides rake tasks for proxmox api'
14
+ spec.description = 'Provides rake tasks to manage proxmox cluster'
15
+ spec.homepage = 'https://github.com/lehn-etracker/rake-proxmox'
16
+ spec.license = 'MIT'
17
+
18
+ if spec.respond_to?(:metadata)
19
+ spec.metadata['allowed_push_host'] = 'https://rubygems.org/'
20
+ else
21
+ raise 'RubyGems 2.0 or newer is required to protect against ' \
22
+ 'public gem pushes.'
23
+ end
24
+
25
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
26
+ f.match(%r{^(test|spec|features)/})
27
+ end
28
+ spec.bindir = 'exe'
29
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
30
+ spec.require_paths = ['lib']
31
+
32
+ spec.add_development_dependency 'bundler', '~> 1.13'
33
+ spec.add_development_dependency 'rake', '~> 10.0'
34
+ spec.add_development_dependency 'rspec', '~> 3.0'
35
+ spec.add_development_dependency 'webmock', '~> 3.0'
36
+
37
+ spec.add_runtime_dependency 'rest-client', '~> 2.0', '>= 2.0.2'
38
+ spec.add_runtime_dependency 'json', '~> 2.1'
39
+ end
metadata ADDED
@@ -0,0 +1,150 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rake-proxmox
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Sebastian Lehn
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-10-24 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.13'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.13'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: webmock
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rest-client
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '2.0'
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ version: 2.0.2
79
+ type: :runtime
80
+ prerelease: false
81
+ version_requirements: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - "~>"
84
+ - !ruby/object:Gem::Version
85
+ version: '2.0'
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: 2.0.2
89
+ - !ruby/object:Gem::Dependency
90
+ name: json
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - "~>"
94
+ - !ruby/object:Gem::Version
95
+ version: '2.1'
96
+ type: :runtime
97
+ prerelease: false
98
+ version_requirements: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - "~>"
101
+ - !ruby/object:Gem::Version
102
+ version: '2.1'
103
+ description: Provides rake tasks to manage proxmox cluster
104
+ email:
105
+ - lehn@etracker.com
106
+ executables: []
107
+ extensions: []
108
+ extra_rdoc_files: []
109
+ files:
110
+ - ".gitignore"
111
+ - ".rspec"
112
+ - ".rubocop.yml"
113
+ - ".travis.yml"
114
+ - CODE_OF_CONDUCT.md
115
+ - Gemfile
116
+ - LICENSE.txt
117
+ - README.md
118
+ - Rakefile
119
+ - bin/console
120
+ - bin/setup
121
+ - lib/rake/proxmox.rb
122
+ - lib/rake/proxmox/proxmox_api.rb
123
+ - lib/rake/proxmox/version.rb
124
+ - rake-proxmox.gemspec
125
+ homepage: https://github.com/lehn-etracker/rake-proxmox
126
+ licenses:
127
+ - MIT
128
+ metadata:
129
+ allowed_push_host: https://rubygems.org/
130
+ post_install_message:
131
+ rdoc_options: []
132
+ require_paths:
133
+ - lib
134
+ required_ruby_version: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ required_rubygems_version: !ruby/object:Gem::Requirement
140
+ requirements:
141
+ - - ">="
142
+ - !ruby/object:Gem::Version
143
+ version: '0'
144
+ requirements: []
145
+ rubyforge_project:
146
+ rubygems_version: 2.5.1
147
+ signing_key:
148
+ specification_version: 4
149
+ summary: Provides rake tasks for proxmox api
150
+ test_files: []