<commit_before># Chef::Knife::Proxmox

Authors: <NAME>, <NAME>, <NAME>

Date: 2013-10-06


## Description

This knife plugin allows to access Proxmox Virtualization Environment (PVE) through its [http://pve.proxmox.com/pve2-api-doc/](API).

Supports both OpenVZ and QEMU instances. Not all API methods are supported quite yet, however most functionality will work.

Bootstrapping is not yet supported. When it is, only OpenVZ instances will be supported.

## Installation

I have yet to upload this to rubygems.org so you'll have to manually build and install:

    $ git clone https://github.com/adamenger/knife-proxmox.git
	$ gem build knife-proxmox/knife-proxmox.gemspec
    $ gem install --local knife-proxmox/knife-proxmox-0.0.20.gem


## knife.rb settings
    knife[:pve_cluster_url] = 'https://vm.adamenger.com:8006/api2/json/'
	knife[:pve_node_name] = "vm"
	knife[:pve_user_name] = "root"
	knife[:pve_user_password] = "password"
	knife[:pve_user_realm] = "pam"

## Actions implemented

+ knife proxmox iso list (options)
+ knife proxmox node list (options)
+ knife proxmox template available (options)
+ knife proxmox template list (options)
+ knife proxmox vm create (options)
+ knife proxmox vm delete (options)
+ knife proxmox vm info (options)
+ knife proxmox vm list (options)
+ knife proxmox vm start (options)
+ knife proxmox vm stop (options)

## Some Examples

### List ISO images
    $ knife proxmox iso list
    Id  Name                                                           Size  
    0   local:iso/CentOS-6.4-i386-minimal.iso                          300 MB
    1   local:iso/CentOS-6.4-x86_64-minimal.iso                        342 MB
    2   local:iso/debian-7.1.0-i386-netinst.iso                        277 MB
    3   local:iso/pfSense-LiveCD-2.0.3-RELEASE-i386-20130412-1022.iso  89 MB 
    4   local:iso/ubuntu-12.04.3-desktop-i386.iso                      707 MB

### List virtual machines
    $ knife proxmox vm list
	Id   Node  Name                   Type    Status
	101  vm    qemu-test              qemu    running
	102  vm    qemu-test2             qemu    stopped
	103  vm    openvz-test            openvz  running
	104  vm    openvz-test2           openvz  running

### List PVE servers
    $ knife proxmox node list
	#  Id       Name  Free Mem  Disk    Uptime
	1  node/vm  vm    10.08GB   923 GB  31 Days

### Get VM information

    **Get all server attributes - OpenVZ**
    $ knife proxmox vm info -I 102
    cpu:       0.00281876923420022
    cpus:      2
    disk:      5833015296
    diskread:  316895232
    diskwrite: 3805184
    failcnt:   0
    ha:        0
    ip:        192.168.42.200
    maxdisk:   8589934592
    maxmem:    4294967296
    maxswap:   536870912
    mem:       1145778176
    name:      test.example.com
    netin:     27888604
    netout:    2829601
    nproc:     140
    status:    running
    swap:      54460416
    type:      openvz
    uptime:    61018

    **Get all server attributes - QEMU**
	$ knife proxmox vm info -I 103
	balloon:   536870912
	cpu:       0
	cpus:      1
	disk:      0
	diskread:  35338740
	diskwrite: 0
	ha:        0
	maxdisk:   0
	maxmem:    536870912
	mem:       151617269
	name:      proxmox
	netin:     0
	netout:    0
	pid:       609365
	qmpstatus: running
	status:    running
	template:
	uptime:    2435

    **Get specific attribute**
    $ knife proxmox vm info -I 102 -f name
    proxmox

### List templates installed
    $ knife proxmox  template list -U https://localhost:8006/api2/json/ -n localhost -u test -p test123 -R pve -VV
    DEBUG: Using configuration from /home/jorge/workspace/chef-repo/.chef/knife.rb
    Id  Name                                                         Size
    0   local:vztmpl/debian-6.0-request-tracker_3.8.8-2_i386.tar.gz  171 MB
    1   local:vztmpl/old_ubuntu-11.10-x86_64.tar.gz                  124 MB<commit_msg>updating README<commit_after># Chef::Knife::Proxmox

Authors: <NAME>, <NAME>, <NAME>

Date: 2013-10-06


## Description

This knife plugin allows to access Proxmox Virtualization Environment (PVE) through its [http://pve.proxmox.com/pve2-api-doc/](API).

Supports both OpenVZ and QEMU instances. Not all API methods are supported quite yet, however most functionality will work.

Bootstrapping is not yet supported. When it is, only OpenVZ instances will be supported.

## Installation

I have yet to upload this to rubygems.org so you'll have to manually build and install:

    $ git clone https://github.com/adamenger/knife-proxmox.git
	$ gem build knife-proxmox/knife-proxmox.gemspec
    $ gem install --local knife-proxmox/knife-proxmox-0.0.20.gem


## knife.rb settings
    knife[:pve_cluster_url] = 'https://vm.adamenger.com:8006/api2/json/'
	knife[:pve_node_name] = "vm"
	knife[:pve_user_name] = "root"
	knife[:pve_user_password] = "password"
	knife[:pve_user_realm] = "pam"

## Actions implemented

+ knife proxmox iso list (options)
+ knife proxmox node list (options)
+ knife proxmox template available (options)
+ knife proxmox template list (options)
+ knife proxmox vm create (options)
+ knife proxmox vm delete (options)
+ knife proxmox vm info (options)
+ knife proxmox vm list (options)
+ knife proxmox vm start (options)
+ knife proxmox vm stop (options)

## Some Examples

### List ISO images
    $ knife proxmox iso list
    Id  Name                                                           Size  
    0   local:iso/CentOS-6.4-i386-minimal.iso                          300 MB
    1   local:iso/CentOS-6.4-x86_64-minimal.iso                        342 MB
    2   local:iso/debian-7.1.0-i386-netinst.iso                        277 MB
    3   local:iso/pfSense-LiveCD-2.0.3-RELEASE-i386-20130412-1022.iso  89 MB 
    4   local:iso/ubuntu-12.04.3-desktop-i386.iso                      707 MB

### List virtual machines
    $ knife proxmox vm list
	Id   Node  Name                   Type    Status
	101  vm    qemu-test              qemu    running
	102  vm    qemu-test2             qemu    stopped
	103  vm    openvz-test            openvz  running
	104  vm    openvz-test2           openvz  running

### List PVE servers
    $ knife proxmox node list
	#  Id       Name  Free Mem  Disk    Uptime
	1  node/vm  vm    10.08GB   923 GB  31 Days

### Get VM information

**Get all server attributes - OpenVZ**
    $ knife proxmox vm info -I 102
    cpu:       0.00281876923420022
    cpus:      2
    disk:      5833015296
    diskread:  316895232
    diskwrite: 3805184
    failcnt:   0
    ha:        0
    ip:        192.168.42.200
    maxdisk:   8589934592
    maxmem:    4294967296
    maxswap:   536870912
    mem:       1145778176
    name:      test.example.com
    netin:     27888604
    netout:    2829601
    nproc:     140
    status:    running
    swap:      54460416
    type:      openvz
    uptime:    61018

**Get all server attributes - QEMU**
	$ knife proxmox vm info -I 103
	balloon:   536870912
	cpu:       0
	cpus:      1
	disk:      0
	diskread:  35338740
	diskwrite: 0
	ha:        0
	maxdisk:   0
	maxmem:    536870912
	mem:       151617269
	name:      proxmox
	netin:     0
	netout:    0
	pid:       609365
	qmpstatus: running
	status:    running
	template:
	uptime:    2435

**Get specific attribute**
    $ knife proxmox vm info -I 102 -f name
    proxmox

### List templates installed
    $ knife proxmox  template list -U https://localhost:8006/api2/json/ -n localhost -u test -p test123 -R pve -VV
    DEBUG: Using configuration from /home/jorge/workspace/chef-repo/.chef/knife.rb
    Id  Name                                                         Size
    0   local:vztmpl/debian-6.0-request-tracker_3.8.8-2_i386.tar.gz  171 MB
    1   local:vztmpl/old_ubuntu-11.10-x86_64.tar.gz                  124 MB
{'fraction_non_alphanumeric': 0.08350622406639004, 'fraction_numerical': 0.08480290456431536, 'mean_word_length': 2.043804262036306, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5637640', 'n_tokens_mistral': 3079, 'n_tokens_neox': 2627, 'n_words': 754}