knife-profitbricks 1.2.1 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/README.md +303 -96
  4. data/knife-profitbricks.gemspec +1 -1
  5. data/lib/chef/knife/profitbricks_base.rb +24 -0
  6. data/lib/chef/knife/profitbricks_composite_server_create.rb +59 -45
  7. data/lib/chef/knife/profitbricks_contract_list.rb +37 -0
  8. data/lib/chef/knife/profitbricks_datacenter_create.rb +8 -7
  9. data/lib/chef/knife/profitbricks_firewall_create.rb +15 -15
  10. data/lib/chef/knife/profitbricks_firewall_delete.rb +6 -8
  11. data/lib/chef/knife/profitbricks_firewall_list.rb +6 -5
  12. data/lib/chef/knife/profitbricks_ipblock_create.rb +6 -7
  13. data/lib/chef/knife/profitbricks_ipfailover_add.rb +60 -0
  14. data/lib/chef/knife/profitbricks_ipfailover_remove.rb +60 -0
  15. data/lib/chef/knife/profitbricks_lan_create.rb +5 -3
  16. data/lib/chef/knife/profitbricks_lan_list.rb +1 -1
  17. data/lib/chef/knife/profitbricks_nic_create.rb +12 -14
  18. data/lib/chef/knife/profitbricks_nic_delete.rb +4 -3
  19. data/lib/chef/knife/profitbricks_nic_list.rb +4 -3
  20. data/lib/chef/knife/profitbricks_server_create.rb +14 -16
  21. data/lib/chef/knife/profitbricks_server_delete.rb +1 -1
  22. data/lib/chef/knife/profitbricks_server_list.rb +1 -1
  23. data/lib/chef/knife/profitbricks_server_reboot.rb +1 -1
  24. data/lib/chef/knife/profitbricks_server_start.rb +1 -1
  25. data/lib/chef/knife/profitbricks_server_stop.rb +1 -1
  26. data/lib/chef/knife/profitbricks_volume_attach.rb +5 -5
  27. data/lib/chef/knife/profitbricks_volume_create.rb +38 -18
  28. data/lib/chef/knife/profitbricks_volume_delete.rb +1 -1
  29. data/lib/chef/knife/profitbricks_volume_detach.rb +4 -4
  30. data/lib/chef/knife/profitbricks_volume_list.rb +5 -6
  31. data/lib/knife-profitbricks/version.rb +1 -1
  32. data/spec/chef/knife/profitbricks_composite_server_create_spec.rb +64 -0
  33. data/spec/chef/knife/profitbricks_contract_list_spec.rb +20 -0
  34. data/spec/chef/knife/profitbricks_datacenter_create_spec.rb +44 -0
  35. data/spec/chef/knife/profitbricks_datacenter_delete_spec.rb +39 -0
  36. data/spec/chef/knife/profitbricks_datacenter_list_spec.rb +7 -6
  37. data/spec/chef/knife/profitbricks_firewall_create_spec.rb +74 -0
  38. data/spec/chef/knife/profitbricks_firewall_delete_spec.rb +86 -0
  39. data/spec/chef/knife/profitbricks_firewall_list_spec.rb +61 -0
  40. data/spec/chef/knife/profitbricks_image_list_spec.rb +19 -0
  41. data/spec/chef/knife/profitbricks_ipblock_create_spec.rb +39 -0
  42. data/spec/chef/knife/profitbricks_ipblock_delete_spec.rb +37 -0
  43. data/spec/chef/knife/profitbricks_ipfailover_add_spec.rb +80 -0
  44. data/spec/chef/knife/profitbricks_ipfailover_remove_spec.rb +85 -0
  45. data/spec/chef/knife/profitbricks_lan_create_spec.rb +59 -0
  46. data/spec/chef/knife/profitbricks_lan_delete_spec.rb +58 -0
  47. data/spec/chef/knife/profitbricks_lan_list_spec.rb +37 -0
  48. data/spec/chef/knife/profitbricks_location_list_spec.rb +24 -0
  49. data/spec/chef/knife/profitbricks_nic_create_spec.rb +71 -0
  50. data/spec/chef/knife/profitbricks_nic_delete_spec.rb +69 -0
  51. data/spec/chef/knife/profitbricks_nic_list_spec.rb +69 -0
  52. data/spec/chef/knife/profitbricks_server_create_spec.rb +63 -0
  53. data/spec/chef/knife/profitbricks_server_delete_spec.rb +63 -0
  54. data/spec/chef/knife/profitbricks_server_list_spec.rb +65 -0
  55. data/spec/chef/knife/profitbricks_server_reboot_spec.rb +65 -0
  56. data/spec/chef/knife/profitbricks_server_start_spec.rb +68 -0
  57. data/spec/chef/knife/profitbricks_server_stop_spec.rb +65 -0
  58. data/spec/chef/knife/profitbricks_volume_attach_spec.rb +70 -0
  59. data/spec/chef/knife/profitbricks_volume_create_spec.rb +63 -0
  60. data/spec/chef/knife/profitbricks_volume_delete_spec.rb +70 -0
  61. data/spec/chef/knife/profitbricks_volume_detach_spec.rb +81 -0
  62. data/spec/chef/knife/profitbricks_volume_list_spec.rb +80 -0
  63. data/spec/spec_helper.rb +22 -3
  64. data/spec/test.sh +1 -1
  65. metadata +81 -18
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0237bc45a0358a6e2620ffd9941416bb51442277
4
- data.tar.gz: 59253a8e95dabc1e97b1f0f09c126b30b4eee233
3
+ metadata.gz: bce4842d7d224840142aac9373abb82b5d3d8f94
4
+ data.tar.gz: d854007f93993768dd63b43c946a8ee55b6024ad
5
5
  SHA512:
6
- metadata.gz: f9b3fd767eb66142ed8eae7e8da5edf9abfbb56102ce77b0eff62798931f48d4fe021e35f593cfb033b8f05f87d072aea7a8f53bcd7dd12d44eb03a7ef8806d2
7
- data.tar.gz: 429ea7698af89c5a632a5787daa1d2ea410d5321961f9371c85ccc98023c9b4fde5c9b8cc63e612cfe5a1700e1c70b8c62f5be0b38206051a6d5ca5215c5b276
6
+ metadata.gz: a4d695ad8f4971730c5945526d7bd682f617cea211a044557592f5a291cd5ce3d7e2428eecb25cba238fb9142e6da468a83313ac81958bdfb1474fc4daf96c13
7
+ data.tar.gz: 8a271f015f30c9c05384352c4c872d4c08f47878b1b9a72663d8cf6085678d1907d2112a85e8c243e99e291deef011c3bbc279575e90e73366b7c0cbb0b00389
data/.gitignore CHANGED
@@ -22,3 +22,4 @@ tmp
22
22
  *.o
23
23
  *.a
24
24
  mkmf.log
25
+ knife.rb
data/README.md CHANGED
@@ -1,17 +1,61 @@
1
- # Knife ProfitBricks
2
-
3
- ## Description
4
-
5
- ProfitBricks Chef Knife plugin
1
+ # ProfitBricks Chef Knife Plugin
2
+
3
+ ## Table of Contents
4
+
5
+ * [Concepts](#concepts)
6
+ * [Requirements](#requirements)
7
+ * [Getting Started](#getting-started)
8
+ * [Installation](#installation)
9
+ * [Configuration](#configuration)
10
+ * [How To](#how-to)
11
+ * [List Data Centers](#list-data-centers)
12
+ * [Create Data Center](#create-data-center)
13
+ * [Create Server](#create-server)
14
+ * [List Servers](#list-servers)
15
+ * [List Images](#list-images)
16
+ * [Create Volume](#create-volume)
17
+ * [List Volumes](#list-volumes)
18
+ * [Attach and Detach Volume](#attach-and-detach-volume)
19
+ * [Reserve IP Block](#reserve-ip-block)
20
+ * [Create Public LAN](#create-public-lan)
21
+ * [Create NIC](#create-nic)
22
+ * [Create Composite Server](#create-composite-server)
23
+ * [Delete Data Center](#delete-data-center)
24
+ * [Reference](#reference)
25
+ * [Location](#location)
26
+ * [Data Center](#data-center)
27
+ * [Server](#server)
28
+ * [Volume](#volume)
29
+ * [Image](#image)
30
+ * [LAN](#lan)
31
+ * [NIC](#nic)
32
+ * [IP Block](#ip-block)
33
+ * [Firewall](#firewall)
34
+ * [IP Failover](#ip-failover)
35
+ * [Support](#support)
36
+ * [Testing](#testing)
37
+ * [Contributing](#contributing)
38
+
39
+ ## Concepts
40
+
41
+ Chef is a popular configuration management tool that allows simplified configuration and maintenance of both servers and cloud provider environments through the use of common templates called recipes. The Chef `knife` command line tool allows management of various nodes within those environments. The `knife-profitbricks` plugin utilizes the ProfitBricks REST API to provision and manage various cloud resources on the ProfitBricks platform.
6
42
 
7
43
  ## Requirements
8
44
 
9
45
  * Chef 12.3.0 or higher
10
46
  * Ruby 2.0.x or higher
11
47
 
48
+ ## Getting Started
49
+
50
+ Before you begin you will need to have [signed-up](https://www.profitbricks.com/signup/) for a ProfitBricks account. The credentials you establish during sign-up will be used to authenticate against the [ProfitBricks Cloud API](https://devops.profitbricks.com/api/).
51
+
12
52
  ## Installation
13
53
 
14
- Add this line to your application's Gemfile:
54
+ The `knife-profitbricks` plugin can be installed as a gem:
55
+
56
+ $ gem install knife-profitbricks
57
+
58
+ Or the plugin can be installed by adding the following line to your application's Gemfile:
15
59
 
16
60
  gem 'knife-profitbricks'
17
61
 
@@ -19,190 +63,353 @@ And then execute:
19
63
 
20
64
  $ bundle
21
65
 
22
- Or install it yourself as:
23
-
24
- $ gem install knife-profitbricks
25
-
26
66
  ## Configuration
27
67
 
28
- The ProfitBricks Chef Knife plugin requires valid ProfitBricks account credentials. These credentials can be added to the `knife.rb` configuration file.
68
+ The ProfitBricks account credentials can be added to the `knife.rb` configuration file.
29
69
 
30
70
  knife[:profitbricks_username] = 'username'
31
71
  knife[:profitbricks_password] = 'password'
32
72
 
33
- If a virtual data center has already been created under the ProfitBricks account, then the data center ID can be added to the `knife.rb` which reduces the need to include the --datacenter-id parameter for each action within the data center.
34
-
73
+ If a virtual data center has already been created under the ProfitBricks account, then the data center UUID can be added to the `knife.rb` which reduces the need to include the `--datacenter-id [datacenter_id]` parameter for each action within the data center.
74
+
35
75
  knife[:datacenter_id] = 'f3f3b6fe-017d-43a3-b42a-a759144b2e99'
36
76
 
37
77
  Optional parameters include the following:
38
78
 
39
79
  knife[:profitbricks_url] = 'https://api.profitbricks.com'
40
80
  knife[:profitbricks_debug] = true
41
-
42
- ## Sub Commands
43
81
 
44
- ### knife profitbricks datacenter create
82
+ The configuration parameters can also be passed using shell environment variables. First, the following should be added to the `knife.rb` configuration file:
45
83
 
46
- Creates a new data center where servers, volumes, and other resources will reside.
84
+ knife[:profitbricks_username] = ENV['PROFITBRICKS_USERNAME']
85
+ knife[:profitbricks_password] = ENV['PROFITBRICKS_PASSWORD']
47
86
 
48
- ### knife profitbricks datacenter delete
87
+ Now the parameters can be set as environment variables:
49
88
 
50
- **USE WITH EXTREME CAUTION**
89
+ $ export PROFITBRICKS_USERNAME='username'
90
+ $ export PROFITBRICKS_PASSWORD='password'
51
91
 
52
- Deletes an existing data center and all resources within that data center.
92
+ # How To
53
93
 
54
- ### knife profitbricks datacenter list
94
+ ## List Data Centers
55
95
 
56
- List all available data centers under the ProfitBricks account.
96
+ ProfitBricks introduces the concept of virtual data centers. These are logically separated from one another and allow you to have a self-contained environment for all servers, volumes, networking, and other resources. The goal is to give you the same experience as you would have if you were running your own physical data center.
57
97
 
58
- ### knife profitbricks firewall create
98
+ A list of available data centers can be obtained with the following command.
59
99
 
60
- Creates a new firewall rule on an existing NIC.
100
+ knife profitbricks datacenter list
61
101
 
62
- ### knife profitbricks firewall delete
102
+ ## Create Data Center
63
103
 
64
- Deletes a firewall rule from an existing NIC.
104
+ Unless you are planning to manage an existing ProfitBricks environment, the first step will typically involve choosing the location for a new virtual data center. A list of locations can be obtained with location command.
65
105
 
66
- ### knife profitbricks firewall list
106
+ knife profitbricks location list
67
107
 
68
- Lists all available firewall rules assigned to a NIC.
108
+ Make a note of the desired location ID and now the data center can be created.
69
109
 
70
- ### knife profitbricks image list
110
+ knife profitbricks datacenter create --name "Production" --description "Production webserver environment" --location "us/las"
71
111
 
72
- Lists all available images.
112
+ ## Create Server
73
113
 
74
- ### knife profitbricks ipblock create
114
+ One of the unique features of the ProfitBricks platform when compared with the other providers is that they allow you to define your own settings for cores, memory, and disk size without being tied to a particular size or flavor.
75
115
 
76
- Reserves a new IP block.
116
+ Note: *The memory parameter value must be a multiple of 256, e.g. 256, 512, 768, 1024, and so forth.*
77
117
 
78
- ### knife profitbricks ipblock delete
118
+ The following example shows you how to create a new server in the data center created above:
79
119
 
80
- Releases a currently assigned IP block.
120
+ knife profitbricks server create --datacenter-id ade28808-9253-4d4e-9f5d-f1f7f1038fb1 --name "Frontend Webserver" --cores 1 --ram 1024 --availability-zone ZONE_1 --cpu-family INTEL_XEON
81
121
 
82
- ### knife profitbricks ipblock list
122
+ ## List Servers
83
123
 
84
- Lists all available IP blocks.
124
+ The new server should appear when listing all servers under the specified data center.
85
125
 
86
- ### knife profitbricks lan create
126
+ knife profitbricks server list --datacenter-id ade28808-9253-4d4e-9f5d-f1f7f1038fb1
87
127
 
88
- Creates a new LAN under a data center.
128
+ ## List Images
89
129
 
90
- ### knife profitbricks lan delete
130
+ A list of disk and ISO images are available from ProfitBricks for immediate use. These can be easily reviewed and selected with the following command.
91
131
 
92
- Deletes an existing LAN.
132
+ knife profitbricks image list
93
133
 
94
- ### knife profitbricks lan list
134
+ Make sure the image you use is in the same location as the virtual data center.
95
135
 
96
- Lists all available LANs under a data center.
136
+ ## Create Volume
97
137
 
98
- ### knife profitbricks location list
138
+ ProfitBricks allows for the creation of multiple storage volumes that can be attached and detached as needed. It is useful to attach an image when creating a storage volume. The storage size is in gigabytes (GB).
99
139
 
100
- List all available regions where a data center may reside.
140
+ knife profitbricks volume create --datacenter-id ade28808-9253-4d4e-9f5d-f1f7f1038fb1 --name "OS Volume" --size 20 --type HDD --image c4263e0f-e75e-11e4-91fd-8fa3eaae9f6b --ssh-keys "ssh-rsa AAAAB3NzaC1..."
101
141
 
102
- ### knife profitbricks nic create
142
+ ## List Volumes
103
143
 
104
- Creates a NIC on the specified server.
144
+ The following example will list all available volumes under a data center.
105
145
 
106
- ### knife profitbricks nic delete
146
+ knife profitbricks volume list --datacenter-id ade28808-9253-4d4e-9f5d-f1f7f1038fb1
107
147
 
108
- Deletes an existing NIC from a server.
148
+ You can also list all volumes attached to a specific server.
109
149
 
110
- ### knife profitbricks nic list
150
+ knife profitbricks volume list --datacenter-id ade28808-9253-4d4e-9f5d-f1f7f1038fb1 --server-id 2e438d3b-02f0-47d0-8594-4ace38ed2804
111
151
 
112
- List all available NICs connected to a server.
152
+ ## Attach and Detach Volume
113
153
 
114
- ### knife profitbricks composite server create
154
+ ProfitBricks allows for the creation of multiple storage volumes. You can detach and reattach these on the fly. This allows for various scenarios such as re-attaching a failed OS disk to another server for possible recovery or moving a volume to another location and bringing it online.
115
155
 
116
- Creates a new composite server with attached volume and NIC in a specified data center.
156
+ The following illustrates how you would attach a volume with a UUID of 9b45f734-01ec-46ca-b163-d06c5a9d707f to a server:
117
157
 
118
- ### knife profitbricks server create
158
+ knife profitbricks volume attach --datacenter-id ade28808-9253-4d4e-9f5d-f1f7f1038fb1 --server-id 2e438d3b-02f0-47d0-8594-4ace38ed2804 9b45f734-01ec-46ca-b163-d06c5a9d707f
119
159
 
120
- Creates a new server within a specified data center.
160
+ If you need to detach the same volume:
121
161
 
122
- ### knife profitbricks server delete
162
+ knife profitbricks volume detach --datacenter-id ade28808-9253-4d4e-9f5d-f1f7f1038fb1 --server-id 2e438d3b-02f0-47d0-8594-4ace38ed2804 9b45f734-01ec-46ca-b163-d06c5a9d707f
123
163
 
124
- Deletes an existing server.
164
+ ## Reserve IP Block
165
+
166
+ The IP block size (number of IP addresses) and location are required to reserve an IP block:
167
+
168
+ knife profitbricks ipblock create --size 5 --location "us/las"
169
+
170
+ ## Create Public LAN
171
+
172
+ A pubic LAN must be created within a data center.
173
+
174
+ knife profitbricks lan create --datacenter-id ade28808-9253-4d4e-9f5d-f1f7f1038fb1 --name "Public Network" --public
125
175
 
126
- ### knife profitbricks server list
176
+ ## Create NIC
177
+
178
+ The ProfitBricks platform supports adding multiple NICs to a server. These NICs can be used to create different, segmented networks on the platform.
179
+
180
+ The example below shows you how to add a second NIC to an existing server and LAN:
181
+
182
+ knife profitbricks nic create --datacenter-id ade28808-9253-4d4e-9f5d-f1f7f1038fb1 --server-id 2e438d3b-02f0-47d0-8594-4ace38ed2804 --name "Public NIC" --lan 1
183
+
184
+ ## Create Composite Server
185
+
186
+ This creates a new composite server with an attached volume and NIC in a specified virtual data center.
187
+
188
+ knife profitbricks composite server create --datacenter-id ade28808-9253-4d4e-9f5d-f1f7f1038fb1 --name "Backend Database" --cores 1 --ram 8192 --size 5 --type SSD --lan 1 --image 2ead2908-df61-11e5-80a4-52540005ab80 --ssh-keys "ssh-rsa AAAAB3NzaC1..."
189
+
190
+ ## Delete Data Center
191
+
192
+ You will want to exercise a bit of caution here. Removing a data center will destroy all objects contained within that data center -- servers, volumes, snapshots, and so on. The objects -- once removed -- will be unrecoverable.
193
+
194
+ knife profitbricks datacenter delete ade28808-9253-4d4e-9f5d-f1f7f1038fb1
195
+
196
+ # Reference
197
+
198
+ ## Location
199
+
200
+ ### List Locations
201
+
202
+ List available physical locations where resources can reside.
203
+
204
+ knife profitbricks location list
205
+
206
+ ## Data Center
207
+
208
+ ### List Data Centers
209
+
210
+ List all available data centers under the ProfitBricks account.
211
+
212
+ knife profitbricks datacenter list
213
+
214
+ ### Create Data Center
215
+
216
+ Creates a new data center where servers, volumes, and other resources will reside.
217
+
218
+ knife profitbricks datacenter create --name [string] --description [string] --location [location_id]
219
+
220
+ ### Delete Data Center
221
+
222
+ * **USE WITH EXTREME CAUTION**
223
+
224
+ Deletes an existing data center and all resources within that data center.
225
+
226
+ knife profitbricks datacenter delete [datacenter_id]
227
+
228
+ ## Server
229
+
230
+ ### List Servers
127
231
 
128
232
  List all available servers under a specified data center.
129
233
 
130
- ### knife profitbricks server reboot
234
+ knife profitbricks server list --datacenter-id [datacenter_id]
235
+
236
+ ### Create Server
237
+
238
+ Creates a new server within a specified data center.
239
+
240
+ knife profitbricks server create --datacenter-id [datacenter_id] --name [string] --cores [int] --ram [int] ...
241
+
242
+ ### Delete Server
243
+
244
+ Deletes an existing server.
245
+
246
+ knife profitbricks server delete --datacenter-id [datacenter_id] [server_id]
247
+
248
+ ### Reboot Server
131
249
 
132
250
  Performs a hard reset on a server.
133
251
 
134
- ### knife profitbricks server start
252
+ knife profitbricks server reboot --datacenter-id [datacenter_id] [server_id]
253
+
254
+ ### Start Server
135
255
 
136
256
  Starts a server.
137
257
 
138
- ### knife profitbricks server stop
258
+ knife profitbricks server start --datacenter-id [datacenter_id] [server_id]
259
+
260
+ ### Stop Server
139
261
 
140
262
  Stops a server.
141
263
 
142
- ### knife profitbricks volume attach
264
+ knife profitbricks server stop --datacenter-id [datacenter_id] [server_id]
143
265
 
144
- Attaches an existing volume to a server.
266
+ ## Volume
145
267
 
146
- ### knife profitbricks volume create
268
+ ### List Volumes
269
+
270
+ Lists all available volumes under a data center. Passing the `--server-id` parameter will also list all volumes attached to the specified server.
271
+
272
+ knife profitbricks volume list --datacenter-id [datacenter_id]
273
+
274
+ knife profitbricks volume list --datacenter-id [datacenter_id] --server-id [server_id]
275
+
276
+ ### Create Volume
147
277
 
148
278
  Creates a new volume.
149
279
 
150
- ### knife profitbricks volume delete
280
+ knife profitbricks volume create --datacenter-id [datacenter_id] --name [string] --size [int] --image [image_id] ...
281
+
282
+ ### Delete Volume
151
283
 
152
284
  Deletes an existing volume.
153
285
 
154
- ### knife profitbricks volume detach
286
+ knife profitbricks volume delete --datacenter-id [datacenter_id] [volume_id]
155
287
 
156
- Detaches a volume from a server.
288
+ ### Attach Volume
157
289
 
158
- ### knife profitbricks volume list
290
+ Attaches an existing volume to a server.
159
291
 
160
- Lists all available volumes under a data center. Passing the `--server-id` parameter will also list all volumes attached to the specified server.
292
+ knife profitbricks volume attach --datacenter-id [datacenter_id] --server-id [server_id] [volume_id]
161
293
 
162
- ## Examples
294
+ ### Detach Volume
163
295
 
164
- To review a list of existing data centers:
296
+ Detaches a volume from a server.
165
297
 
166
- knife profitbricks datacenter list
298
+ knife profitbricks volume detach --datacenter-id [datacenter_id] --server-id [server_id] [volume_id]
167
299
 
168
- The first step is to usually identify a location where the data center should reside as well as an image to use. It is **important** to note that the image must exist in the same location as the data center. Make a note of the image UUID.
300
+ ## Image
301
+
302
+ ### List Images
303
+
304
+ Lists all available images.
169
305
 
170
306
  knife profitbricks image list
171
- knife profitbricks location list
172
307
 
173
- Now the data center can be created.
308
+ ## LAN
174
309
 
175
- knife profitbricks datacenter create --name "Production" --description "Production webserver environment" --location "us/las"
310
+ ### List LANs
176
311
 
177
- Once the data center is provisioned, both a server and volume can be created. The volume will use an existing image as identified above.
312
+ Lists all available LANs under a data center.
178
313
 
179
- knife profitbricks server create --datacenter-id ade28808-9253-4d4e-9f5d-f1f7f1038fb1 --name "Frontend Webserver" --cores 1 --ram 1024 --availability-zone ZONE_1 --cpu-family INTEL_XEON
180
- knife profitbricks volume create --datacenter-id ade28808-9253-4d4e-9f5d-f1f7f1038fb1 --name "OS Volume" --size 5 --type HDD --image c4263e0f-e75e-11e4-91fd-8fa3eaae9f6b --ssh-keys "ssh-rsa AAAAB3NzaC1..."
314
+ knife profitbricks lan list
181
315
 
182
- The volume can then be attached to the server.
316
+ ### Create LAN
183
317
 
184
- knife profitbricks volume attach --datacenter-id ade28808-9253-4d4e-9f5d-f1f7f1038fb1 --server-id 2e438d3b-02f0-47d0-8594-4ace38ed2804 9b45f734-01ec-46ca-b163-d06c5a9d707f
318
+ Creates a new LAN under a data center.
185
319
 
186
- Now a NIC can be added the new server. The LAN will automatically be created if a non-existent LAN ID is passed with the `--lan` parameter.
320
+ knife profitbricks lan create --datacenter-id [datacenter_id] --name [string] [--public]
187
321
 
188
- knife profitbricks nic create --datacenter-id ade28808-9253-4d4e-9f5d-f1f7f1038fb1 --server-id 2e438d3b-02f0-47d0-8594-4ace38ed2804 --name "Primary NIC" --lan 1
322
+ ### Delete LAN
189
323
 
190
- Here is an example of adding a firewall rule to the newly created NIC.
324
+ Deletes an existing LAN.
191
325
 
192
- knife profitbricks firewall create --datacenter-id ade28808-9253-4d4e-9f5d-f1f7f1038fb1 --server-id 2e438d3b-02f0-47d0-8594-4ace38ed2804 --nic-id e4270ecc-e9c5-4de0-940a-8a0a99d962fd --name "SSH" --protocol TCP --port-range-start 22 --port-range-end 22 --source-ip 203.0.113.10
326
+ knife profitbricks lan delete --datacenter-id [datacenter_id]
193
327
 
194
- A composite server can also be created with attached volume and NIC in a single command.
328
+ ## NIC
195
329
 
196
- knife profitbricks composite server create --datacenter-id ade28808-9253-4d4e-9f5d-f1f7f1038fb1 --name "Backend Database" --cores 1 --ram 8192 --size 5 --type SSD --lan 1 --image 2ead2908-df61-11e5-80a4-52540005ab80 --ssh-keys "ssh-rsa AAAAB3NzaC1..."
330
+ ### List NICs
197
331
 
198
- The new data center and **all resources within that data center** can be deleted.
332
+ List all available NICs connected to a server.
199
333
 
200
- knife profitbricks datacenter delete ade28808-9253-4d4e-9f5d-f1f7f1038fb1
334
+ knife profitbricks nic list
335
+
336
+ ### Create NIC
337
+
338
+ Creates a NIC on the specified server.
339
+
340
+ knife profitbricks nic create --datacenter-id [datacenter_id] --server-id [server_id] --name [string] --lan [int] -ips IP[,IP,...] [--dhcp]
341
+
342
+ ### Delete NIC
343
+
344
+ Deletes an existing NIC from a server.
345
+
346
+ knife profitbricks nic delete --datacenter-id [datacenter_id] [nic_id]
347
+
348
+ ## IP Block
349
+
350
+ ### List IP Blocks
351
+
352
+ Lists all available IP blocks.
353
+
354
+ knife profitbricks ipblock list
355
+
356
+ ### Reserve IP Block
357
+
358
+ Reserve a new IP block.
359
+
360
+ knife profitbricks ipblock create --size [int] --location [string]
361
+
362
+ ### Release IP Block
363
+
364
+ Releases a currently assigned IP block.
365
+
366
+ knife profitbricks ipblock delete [ipblock_id]
367
+
368
+ ## Firewall
369
+
370
+ ### List Firewall Rules
371
+
372
+ Lists all available firewall rules assigned to a NIC.
373
+
374
+ knife profitbricks firewall list
375
+
376
+ ### Create Firewall Rule
377
+
378
+ Creates a new firewall rule on an existing NIC.
379
+
380
+ knife profitbricks firewall create --datacenter-id [datacenter_id] --server-id [server_id] --nic-id [nic_id] --name [string] --protocol [TCP, UDP] --port-range-start [int] --port-range-end [int] --source-ip [IP]
381
+
382
+ ### Delete Firewall Rule
383
+
384
+ Deletes a firewall rule from an existing NIC.
385
+
386
+ knife profitbricks firewall delete --datacenter-id [datacenter_id] --server-id [server_id] --nic-id [nic_id] [firewall_id]
387
+
388
+ ## IP Failover
389
+
390
+ ### Add IP to LAN failover group
391
+
392
+ Adds IPs to LAN
393
+
394
+ knife profitbricks failover add --datacenter-id [datacenter_id] --lan-id [lan_id] --ip [ip1] --nic-id [nic_id]
395
+
396
+ ### Remove IP from LAN failover group
397
+
398
+ Remove IP Failover from LAN
399
+
400
+ knife profitbricks failover remove --datacenter-id [datacenter_id] --lan-id [lan_id] --ip [ip1] --nic-id [nic_id]
401
+
402
+ ## Contract Resources
403
+
404
+ Lists information about available contract resources
405
+
406
+ knife profitbricks contract list
407
+
408
+ ## Support
201
409
 
202
- ## Documentation and Support
410
+ Please report any issues through the [project repository on GitHub](https://github.com/profitbricks/knife-profitbricks).
203
411
 
204
- * [ProfitBricks REST API](https://devops.profitbricks.com/api/rest/) documentation.
205
- * Ask a question or discuss at [ProfitBricks DevOps Central](https://devops.profitbricks.com/community).
412
+ Questions and discussions can be directed to [ProfitBricks DevOps Central](https://devops.profitbricks.com/) site.
206
413
 
207
414
  ## Testing
208
415
 
@@ -210,8 +417,8 @@ The new data center and **all resources within that data center** can be deleted
210
417
 
211
418
  ## Contributing
212
419
 
213
- 1. Fork it ( https://github.com/[my-github-username]/knife-profitbricks/fork )
214
- 2. Create your feature branch (`git checkout -b my-new-feature`)
215
- 3. Commit your changes (`git commit -am 'Add some feature'`)
216
- 4. Push to the branch (`git push origin my-new-feature`)
217
- 5. Create a new Pull Request
420
+ 1. Fork it ( https://github.com/[my-github-username]/knife-profitbricks/fork ).
421
+ 2. Create your feature branch (`git checkout -b my-new-feature`).
422
+ 3. Commit your changes (`git commit -am 'Add some feature'`).
423
+ 4. Push to the branch (`git push origin my-new-feature`).
424
+ 5. Create a new Pull Request.