Working with Knife and HP Cloud Services

HP Cloud Services

We are excited to announce the availability of the new Opscode Knife plugin for HP Cloud Services. This plugin gives knife the ability to create, bootstrap and manage instances in HP Cloud Services Compute, currently in beta.

knife hp server list

This will give you a list of all servers in the currently configured HP Compute Cloud account.

[sourcecode]$ knife hp server list
Instance ID Name Public IP Private IP Flavor Image Key Pair State
65639 hp15-185-113-235 15.185.113.235 10.4.5.158 101 1236 hptesting active
65640 hp15-185-113-240 15.185.113.240 10.4.22.15 101 1236 hptesting active
65641 hp15-185-114-125 15.185.114.125 10.4.20.205 101 1236 hptesting active
65642 hp15-185-114-56 15.185.114.56 10.4.8.26 101 1236 hptesting active
65643 hp15-185-114-126 15.185.114.126 10.4.22.27 101 1236 hptesting active
65644 hp15-185-114-149 15.185.114.149 10.4.21.6 101 1236 hptesting active
65645 hp15-185-114-148 15.185.114.148 10.4.20.195 101 1236 hptesting active
65646 hp15-185-114-127 15.185.114.127 10.4.21.238 101 1236 hptesting active[/sourcecode]

knife hp flavor list

Outputs a list of all available flavors (available hardware configuration for a server) available to the currently configured HP Compute Cloud account. Each flavor has a unique combination of virtual cores, disk space and memory capacity.

[sourcecode]$ knife hp flavor list
ID Name Cores RAM Disk
100 standard.xsmall 1 1024 MB 30 GB
101 standard.small 2 2048 MB 60 GB
102 standard.medium 2 4096 MB 120 GB
103 standard.large 4 8192 MB 240 GB
104 standard.xlarge 4 16384 MB 480 GB
105 standard.2xlarge 8 32768 MB 960 GB[/sourcecode]

knife hp image list

Outputs a list of all available images available to the currently configured HP Compute Cloud account.

[sourcecode]$ knife hp image list
ID Name
1234 CentOS 5.6 Server 64-bit
1358 CentOS 6.2 Server 64-bit
1361 Debian Squeeze 6.0.3 Server 64-bit
1236 Ubuntu Lucid 10.04 LTS Server 64-bit
1238 Ubuntu Maverick 10.10 Server 64-bit
1240 Ubuntu Natty 11.04 Server 64-bit
1242 Ubuntu Oneiric 11.10 Server 64-bit[/sourcecode]

knife hp server create

Provisions a new server in the HP Compute Cloud and then perform a Chef bootstrap (using the SSH protocol). The goal of the bootstrap is to get Chef installed on the target system so it can run Chef Client with a Chef Server.

[sourcecode]$ knife hp server create -f 101 -I 1236 -S hptesting -x ubuntu -i ~/.ssh/hptesting.pem -d omnibus -r ‘role[base]’ 2
Instance ID: 65646
Instance Name: hp15-185-114-127
Flavor: 101
Image: 1236
SSH Key Pair: hptesting

Waiting for server……………………………………..
Public IP Address: 15.185.114.127
Private IP Address: 10.4.21.238

Waiting for sshd..done
Bootstrapping Chef on 15.185.114.127
15.185.114.127 –2012-03-09 18:18:17– http://opscode.com/chef/install.sh
…………

…………
15.185.114.127 [Fri, 09 Mar 2012 18:19:20 +0000] INFO: Chef Run complete in 25.468149268 seconds
15.185.114.127 [Fri, 09 Mar 2012 18:19:20 +0000] INFO: Running report handlers
15.185.114.127 [Fri, 09 Mar 2012 18:19:20 +0000] INFO: Report handlers complete

Instance ID: 65646
Instance Name: hp15-185-114-127
Flavor: 101
Image: 1236
SSH Key Pair: hptesting
Public IP Address: 15.185.114.127
Private IP Address: 10.4.21.238
Environment: _default
Run List: role[base][/sourcecode]

knife hp server delete

Deletes an existing server in the currently configured HP Compute Cloud account.

[sourcecode]$ knife hp server delete 65646 -y
Instance ID: 65646
Instance Name: hp15-185-114-127
Flavor: 101
Image: 1236
Public IP Address: 15.185.114.127
Private IP Address: 10.4.21.238

WARNING: Deleted server 65646[/sourcecode]

Configuration and Installation

In order to communicate with HP Compute Cloud’s API you will need to tell Knife the account ID, the secret key and tenant ID (you may also override the auth URI and availability zone). This plugin is still in active development, but it is fully functional today. Configuration and installation instructions are detailed further in the README on GitHub.

Going Forward

Looking ahead there will be further refinement to make ‘knife hp‘ a more polished experience. There is an ‘hp‘ Ohai plugin under development that will populate the ‘hp‘ and ‘cloud‘ attributes on nodes as well. Once HP Cloud Services leaves beta, it will already be well-supported by Chef.

Avatar
Matt Ray

Matt is Chef's Manager/Solutions Architect for APAC. Currently based in Sydney, Australia. He's been with Chef for 6 years in a wide variety of roles including Director of Partner Integration most recently.