Understanding DevOps and Cloud Maturity Models: A Guide to Elevating Your IT Strategy
In today’s fast-paced technological landscape, DevOps and Cloud practices are integral to accelerating software delivery and optimizing cloud resources. But as
This is a followup article to Using Test Kitchen With Puppet. This time we want to run our tests against an Openstack deployment. You can follow my article Howto Create A Minimal Viable OpenStack Deployment With Devstack In Your Local LAN to install and use one.
We have to add a new driver to our configuration. There already exists one so lets use kitchen-openstack:
1echo 'gem "kitchen-openstack"' >> Gemfile
2```bash
3
4Install the new dependency
5
6```bash
7bundle install
8Using CFPropertyList (2.2.7)
9Using builder (3.2.2)
10Using excon (0.33.0)
11Using facter (2.0.1)
12Using formatador (0.2.4)
13Using mime-types (2.2)
14Using net-ssh (2.9.0)
15Using net-scp (1.2.1)
16Using fog-core (1.22.0)
17Using multi_json (1.10.0)
18Using fog-json (1.0.0)
19Using fog-brightbox (0.0.2)
20Using mini_portile (0.5.3)
21Using nokogiri (1.6.1)
22Using fog (1.22.0)
23Using json_pure (1.8.1)
24Using hiera (1.3.2)
25Using highline (1.6.21)
26Using json (1.8.1)
27Using mixlib-shellout (1.4.0)
28Using safe_yaml (1.0.3)
29Using thor (0.19.1)
30Using test-kitchen (1.2.1)
31Using unf_ext (0.0.6)
32Using unf (0.1.4)
33Using kitchen-openstack (1.4.0)
34Using kitchen-puppet (0.0.8)
35Using kitchen-vagrant (0.15.0)
36Using librarian (0.1.2)
37Using librarian-puppet (1.0.1)
38Using rgen (0.6.6)
39Using puppet (3.5.1)
40Using bundler (1.5.3)
41Your bundle is complete!
42Use `bundle show [gemname]` to see where a bundled gem is installed.
43```bash
44
45To use it we have to add a configuration to it. From the `README`:
46
47```bash
48driver:
49 name: openstack
50 openstack_username: [YOUR OPENSTACK USERNAME]
51 openstack_api_key: [YOUR OPENSTACK API KEY]
52 openstack_auth_url: [YOUR OPENSTACK AUTH URL]
53 require_chef_omnibus: latest (if you'll be using Chef)
54 image_ref: [SERVER IMAGE ID]
55 flavor_ref: [SERVER FLAVOR ID]
56```bash
57
58We can overlay our `kitchen.yml` with a local configuration to make use of our OpenStack cluster without having this private information in the repo itself.
59
60```bash
61 cat > .kitchen.local.yml <<CONFIG
62---
63
64driver:
65 name: openstack
66 openstack_username: "demo"
67 openstack_api_key: "password"
68 openstack_auth_url: "http://192.168.1.222:5000/v2.0/tokens"
69 openstack_tenant: "demo"
70 disable_ssl_validation: true
71 key_name: "ci"
72 private_key_path: "/Users/ehaselwanter/.ssh/ci.key"
73 public_key_path: "/Users/ehaselwanter/.ssh/ci.key.pub"
74 floating_ip_pool: public
75 security_groups:
76 - default
77 - ssh
78 network_ref:
79 - private
80
81platforms:
82- name: ubuntu-12.04
83 driver:
84 image_ref: Ubuntu 12.04 LTS
85 flavor_ref: m1.small
86 username: ubuntu
87CONFIG
88```bash
89
90## Prepare OpenStack Cluster
91
92To really be able to use this configuration we have to prepare our OpenStack cluster (or update the config according to an existing cluster). Let's have look at the settings.
93
94```bash
95 openstack_username: "demo"
96 openstack_api_key: "password"
97 openstack_auth_url: "http://192.168.1.222:5000/v2.0/tokens"
98 openstack_tenant: "demo"
99```bash
100
101This is very obvious. We need an user, password and endpoint. My OpenStack cluster runs in the local LAN and is accessible at `192.168.1.222`. You can follow my [quick-start guide on how to use OpenStack](http://ehaselwanter.com/en/blog/2014/04/16/susecloud-part-4-i-have-a-suse-openstack-cloud-now-what/) for some of the following commands. You do not need to set this up for kitchen, but it helps debugging. Install the command line tools and setup the same credentials as for kitchen:
102
103```bash
104cat > devstack-demo <<CONFIG
105export OS_IDENTITY_API_VERSION=2.0
106export OS_PASSWORD=password
107export OS_AUTH_URL=http://192.168.1.222:5000/v2.0
108export OS_USERNAME=demo
109export OS_TENANT_NAME=demo
110CONFIG
111source devstack-demo
112```bash
113
114And verify that it is working
115
116```bash
117nova list
118+----+------+--------+------------+-------------+----------+
119| ID | Name | Status | Task State | Power State | Networks |
120+----+------+--------+------------+-------------+----------+
121+----+------+--------+------------+-------------+----------+
122```bash
123
124We need a ssh key in our tenant. So either add one or create one.
125
126```bash
127 key_name: "ci"
128 private_key_path: "/Users/ehaselwanter/.ssh/ci.key"
129 public_key_path: "/Users/ehaselwanter/.ssh/ci.key.pub"
130```bash
131
132with the key present
133
134```bash
135nova keypair-list
136+------+-------------------------------------------------+
137| Name | Fingerprint |
138+------+-------------------------------------------------+
139| ci | 85:46:8f:8e:d4:a9:d7:eb:de:a5:dd:70:ed:ae:7a:9f |
140+------+-------------------------------------------------+
141```bash
142
143Test Kitchen must be able to connect to the instance it creates. So we need to have a public network and floating IPs setup and reachable from wherever you want to run the `kitchen` command.
144
145So let us check if we are able to create floating IPs and from what pool they come from:
146
147```bash
148nova floating-ip-create
149+---------------+-----------+----------+--------+
150| Ip | Server Id | Fixed Ip | Pool |
151+---------------+-----------+----------+--------+
152| 192.168.1.131 | | - | public |
153+---------------+-----------+----------+--------+
154```bash
155
156We see the pool is named `public`.
157
158```bash
159 floating_ip_pool: public
160```bash
161
162Next up the ssh connection. We need to ensure that we are able to connect with ssh. So we have to add appropriate security groups.
163
164```bash
165nova secgroup-create ssh ssh
166nova secgroup-add-rule ssh tcp 22 22 0.0.0.0/0
167```bash
168
169And tell test-kitchen to use it:
170
171```bash
172 security_groups:
173 - default
174 - ssh
175```bash
176
177Booting instances in OpenStack requires us to set a network to attach to. Let's do that. What networks have we got:
178
179```bash
180nova network-list
181+--------------------------------------+---------+------+
182| ID | Label | Cidr |
183+--------------------------------------+---------+------+
184| 68a61467-5b25-4799-be4a-4b7c368282e5 | public | - |
185| aeda7456-2452-4ba3-8803-987fdea86867 | private | - |
186+--------------------------------------+---------+------+
187```bash
188
189So `private` it is:
190
191```bash
192 network_ref:
193 - private
194```bash
195
196Then we need a image in glance to run our tests on. The relevant section is the `platforms` section. If you did not do so, add Ubuntu
197
198```bash
199wget https://cloud-images.ubuntu.com/precise/current/precise-server-cloudimg-amd64-disk1.img
200glance add is_public=true container_format=bare disk_format=qcow2 distro="Ubuntu" name="Ubuntu 12.04 LTS" < ubuntu-12.04-server-cloudimg-amd64-disk1.img
201
202```bash
203
204and see if we have got one:
205
206```bash
207glance image-list
208+--------------------------------------+---------------------------------+-------------+------------------+-----------+--------+
209| ID | Name | Disk Format | Container Format | Size | Status |
210+--------------------------------------+---------------------------------+-------------+------------------+-----------+--------+
211| 4048550e-c61c-4de9-814c-b3d1d26b60d7 | Ubuntu 12.04 LTS | qcow2 | bare | 255328768 | active |
212+--------------------------------------+---------------------------------+-------------+------------------+-----------+--------+
213```bash
214
215This is the official Ubuntu image. The user `ubuntu` gets the key injected and we can use it for our testing. The only thing missing is an appropriate flavor. You have to use one which fits your images requirements.
216
217```bash
218nova flavor-list
219+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+
220| ID | Name | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public |
221+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+
222| 1 | m1.tiny | 512 | 1 | 0 | | 1 | 1.0 | True |
223| 2 | m1.small | 2048 | 20 | 0 | | 1 | 1.0 | True |
224| 3 | m1.medium | 4096 | 40 | 0 | | 2 | 1.0 | True |
225| 4 | m1.large | 8192 | 80 | 0 | | 4 | 1.0 | True |
226| 42 | m1.nano | 64 | 0 | 0 | | 1 | 1.0 | True |
227| 5 | m1.xlarge | 16384 | 160 | 0 | | 8 | 1.0 | True |
228| 84 | m1.micro | 128 | 0 | 0 | | 1 | 1.0 | True |
229+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+
230```bash
231
232We need a flavor big enough for our tests and image. `m1.small` looks good enough. Disk can hold our OS and RAM is plenty for installing ntp. So finally this section looks like:
233
234```bash
235platforms:
236- name: ubuntu-12.04
237 driver:
238 image_ref: Ubuntu 12.04 LTS
239 flavor_ref: m1.small
240 username: ubuntu
241```bash
242
243Now everything should be in place to focus on test-kitchen again. A final sanity check would be to start an instance, assign it a floating ip, connect to it, and finally check if you have internet in the vm. So lets do that:
244
245```bash
246nova boot --flavor 2 --image 4048550e-c61c-4de9-814c-b3d1d26b60d7 --key_name ci --nic net-id=aeda7456-2452-4ba3-8803-987fdea86867 kitchen-test
247+--------------------------------------+---------------------------------------------------------+
248| Property | Value |
249+--------------------------------------+---------------------------------------------------------+
250| OS-DCF:diskConfig | MANUAL |
251| OS-EXT-AZ:availability_zone | nova |
252| OS-EXT-STS:power_state | 0 |
253| OS-EXT-STS:task_state | scheduling |
254| OS-EXT-STS:vm_state | building |
255| OS-SRV-USG:launched_at | - |
256| OS-SRV-USG:terminated_at | - |
257| accessIPv4 | |
258| accessIPv6 | |
259| adminPass | oHmjY68uCybX |
260| config_drive | |
261| created | 2014-05-12T12:25:36Z |
262| flavor | m1.small (2) |
263| hostId | |
264| id | d93e8782-8f95-4f57-9813-2ff7e5c92755 |
265| image | Ubuntu 12.04 LTS (4048550e-c61c-4de9-814c-b3d1d26b60d7) |
266| key_name | ci |
267| metadata | {} |
268| name | kitchen-test |
269| os-extended-volumes:volumes_attached | [] |
270| progress | 0 |
271| security_groups | default |
272| status | BUILD |
273| tenant_id | 8eba7f20d1f342ea921fdbca0650b6f8 |
274| updated | 2014-05-12T12:25:36Z |
275| user_id | 4ad8fc6b05234872a83b06de2430cb2b |
276+--------------------------------------+---------------------------------------------------------+
277```bash
278
279Attach a floating ip to the instance:
280
281```bash
282nova list
283+--------------------------------------+--------------+--------+------------+-------------+--------------------+
284| ID | Name | Status | Task State | Power State | Networks |
285+--------------------------------------+--------------+--------+------------+-------------+--------------------+
286| d93e8782-8f95-4f57-9813-2ff7e5c92755 | kitchen-test | ACTIVE | - | Running | private=172.24.4.3 |
287+--------------------------------------+--------------+--------+------------+-------------+--------------------+
288```bash
289
290```bash
291neutron port-list
292+--------------------------------------+------+-------------------+-----------------------------------------------------------------------------------+
293| id | name | mac_address | fixed_ips |
294+--------------------------------------+------+-------------------+-----------------------------------------------------------------------------------+
295| 2ddd42b2-1507-4f71-a01e-ca9f153848a0 | | fa:16:3e:48:a0:fc | {"subnet_id": "4066948a-f022-4954-9148-4d9f63f96eee", "ip_address": "172.24.4.3"} |
296| c5bb6fe1-280f-4986-91b5-900dab473a41 | | fa:16:3e:e1:9b:a4 | {"subnet_id": "4066948a-f022-4954-9148-4d9f63f96eee", "ip_address": "172.24.4.1"} |
297| d9414f4d-30ce-4597-813c-f46f136a0fbc | | fa:16:3e:72:e3:68 | {"subnet_id": "4066948a-f022-4954-9148-4d9f63f96eee", "ip_address": "172.24.4.2"} |
298+--------------------------------------+------+-------------------+-----------------------------------------------------------------------------------+
299```bash
300
301```bash
302neutron floatingip-list
303+--------------------------------------+------------------+---------------------+---------+
304| id | fixed_ip_address | floating_ip_address | port_id |
305+--------------------------------------+------------------+---------------------+---------+
306| 1b19cc96-354e-4628-8304-762fa68042c1 | | 192.168.1.130 | |
307| e4cee676-0fbf-4d53-826c-1b595c6d4b87 | | 192.168.1.131 | |
308| e9682325-b2d8-419c-bb1c-6e3fb4fcfdbf | | 192.168.1.129 | |
309+--------------------------------------+------------------+---------------------+---------+
310```bash
311
312This information can be used to associate the floating IP
313
314```bash
315neutron floatingip-associate e4cee676-0fbf-4d53-826c-1b595c6d4b87 2ddd42b2-1507-4f71-a01e-ca9f153848a0
316Associated floatingip e4cee676-0fbf-4d53-826c-1b595c6d4b87
317```bash
318
319And we can test to connect
320
321```bash
322ssh -i ~/.ssh/ci.key ubuntu@192.168.1.131
323The authenticity of host '192.168.1.131 (192.168.1.131)' can't be established.
324RSA key fingerprint is c1:a3:f9:8a:c4:0c:17:b3:4b:b2:3a:10:5d:a5:66:34.
325Are you sure you want to continue connecting (yes/no)? yes
326Warning: Permanently added '192.168.1.131' (RSA) to the list of known hosts.
327Welcome to Ubuntu 12.04.4 LTS (GNU/Linux 3.2.0-59-virtual x86_64)
328```bash
329
330and see if we got internet
331
332```bash
333ubuntu@kitchen-test:~$ curl -I http://getchef.com
334HTTP/1.1 301 Moved Permanently
335Server: ngx_openresty
336Date: Mon, 12 May 2014 12:35:03 GMT
337Content-Type: text/html
338Content-Length: 178
339Connection: keep-alive
340Location: http://www.getchef.com/
341P3P: CP="CAO PSA OUR"
342```bash
343
344With this we confirmed that we have an OpenStack cluster ready to be consumed by test-kitchen:
345
346```bash
347kitchen list
348Instance Driver Provisioner Last Action
349default-ubuntu-1204 Openstack PuppetApply <Not Created>
350```bash
351
352So step by step. First create the instance:
353
354```bash
355± kitchen create
356-----> Starting Kitchen (v1.2.1)
357-----> Creating <default-ubuntu-1204>...
358 OpenStack instance <f7b3177e-7056-4d44-9583-6bbaf8abb82e> created.
359.....
360(server ready)
361 Attaching floating IP from <public> pool
362 Attaching floating IP <192.168.1.130>
363 Waiting for 192.168.1.130:22...
364[ ... snipped waiting lines ...]
365 Waiting for 192.168.1.130:22...
366 (ssh ready)
367 Using OpenStack keypair <ci>
368 Using public SSH key </Users/ehaselwanter/.ssh/ci.key.pub>
369 Using private SSH key </Users/ehaselwanter/.ssh/ci.key>
370 Finished creating <default-ubuntu-1204> (2m10.92s).
371-----> Kitchen is finished. (2m12.38s)
372
373```bash
374
375This is working. Let us verify our manifest:
376
377```bash
378kitchen verify
379-----> Starting Kitchen (v1.2.1)
380-----> Converging <default-ubuntu-1204>...
381 Preparing files for transfer
382 Preparing modules
383 Resolving module dependencies with Librarian-Puppet 1.0.1...
384 Preparing manifests
385 Preparing hiera data
386 Finished Preparing files for transfer
387 Installing puppet, will try to determine platform os
388sudo: unable to resolve host default-ubuntu-1204-ehaselwanter-cora
389 --2014-05-12 12:41:40-- http://apt.puppetlabs.com/puppetlabs-release-precise.deb
390Resolving apt.puppetlabs.com (apt.puppetlabs.com)... 198.58.114.168, 2600:3c00::f03c:91ff:fe69:6bf0
391Connecting to apt.puppetlabs.com (apt.puppetlabs.com)|198.58.114.168|:80... connected.
392HTTP request sent, awaiting response... 200 OK
393Length: 3430 (3.3K) [application/x-debian-package]
394 Saving to: `puppetlabs-release-precise.deb'
395
396100%[======================================>] 3,430 --.-K/s in 0s
397
398 2014-05-12 12:41:41 (18.8 MB/s) - `puppetlabs-release-precise.deb' saved [3430/3430]
399
400sudo: unable to resolve host default-ubuntu-1204-ehaselwanter-cora
401 Selecting previously unselected package puppetlabs-release.
402(Reading database ... 47501 files and directories currently installed.)
403 Unpacking puppetlabs-release (from puppetlabs-release-precise.deb) ...
404 Setting up puppetlabs-release (1.0-7) ...
405 Processing triggers for initramfs-tools ...
406 update-initramfs: Generating /boot/initrd.img-3.2.0-59-virtual
407[ ... snipped ... ]
408Get:34 http://nova.clouds.archive.ubuntu.com precise-updates/universe Translation-en [140 kB]
409 Fetched 10.8 MB in 16s (636 kB/s)
410 package lists... Done
411sudo: unable to resolve host default-ubuntu-1204-ehaselwanter-cora
412 package lists... Done
413 g dependency tree
414 state information... Done
415 The following extra packages will be installed:
416 augeas-lenses debconf-utils facter hiera libaugeas-ruby libaugeas-ruby1.8
417 libaugeas0 libjson-ruby libreadline5 libruby libruby1.8 libshadow-ruby1.8
418 puppet-common ruby ruby-json ruby-rgen ruby1.8 virt-what
419 Suggested packages:
420 augeas-doc augeas-tools puppet-el vim-puppet ruby-selinux libselinux-ruby1.8
421 librrd-ruby1.9.1 librrd-ruby1.8 ri ruby-dev ruby1.8-examples ri1.8
422 Recommended packages:
423 rdoc
424 The following NEW packages will be installed:
425 augeas-lenses debconf-utils facter hiera libaugeas-ruby libaugeas-ruby1.8
426 libaugeas0 libjson-ruby libreadline5 libruby libruby1.8 libshadow-ruby1.8
427 puppet puppet-common ruby ruby-json ruby-rgen ruby1.8 virt-what
428 0 upgraded, 19 newly installed, 0 to remove and 32 not upgraded.
429 Need to get 3,900 kB of archives.
430 After this operation, 15.0 MB of additional disk space will be used.
431Get:1 http://nova.clouds.archive.ubuntu.com/ubuntu/ precise/main libreadline5 amd64 5.2-11 [128 kB]
432Get:2 http://apt.puppetlabs.com/ precise/main facter amd64 2.0.1-1puppetlabs1 [73.8 kB]
433Get:3 http://apt.puppetlabs.com/ precise/main hiera all 1.3.2-1puppetlabs1 [12.6 kB]
434Get:4 http://apt.puppetlabs.com/ precise/dependencies ruby-rgen all 0.6.5-1puppetlabs1 [82.2 kB]
435Get:5 http://nova.clouds.archive.ubuntu.com/ubuntu/ precise/main augeas-lenses all 0.10.0-0ubuntu4 [175 kB]
436Get:6 http://apt.puppetlabs.com/ precise/main puppet-common all 3.5.1-1puppetlabs1 [1,242 kB]
437Get:7 http://nova.clouds.archive.ubuntu.com/ubuntu/ precise/main debconf-utils all 1.5.42ubuntu1 [54.9 kB]
438Get:8 http://nova.clouds.archive.ubuntu.com/ubuntu/ precise-updates/main libruby1.8 amd64 1.8.7.352-2ubuntu1.4 [1,797 kB]
439Get:9 http://apt.puppetlabs.com/ precise/main puppet all 3.5.1-1puppetlabs1 [9,616 B]
440Get:10 http://nova.clouds.archive.ubuntu.com/ubuntu/ precise-updates/main ruby1.8 amd64 1.8.7.352-2ubuntu1.4 [33.8 kB]
441Get:11 http://nova.clouds.archive.ubuntu.com/ubuntu/ precise/main ruby all 4.8 [5,054 B]
442Get:12 http://nova.clouds.archive.ubuntu.com/ubuntu/ precise/universe virt-what amd64 1.11-1 [12.9 kB]
443Get:13 http://nova.clouds.archive.ubuntu.com/ubuntu/ precise/main libaugeas0 amd64 0.10.0-0ubuntu4 [171 kB]
444Get:14 http://nova.clouds.archive.ubuntu.com/ubuntu/ precise/main libaugeas-ruby1.8 amd64 0.3.0-1.1ubuntu4 [9,642 B]
445Get:15 http://nova.clouds.archive.ubuntu.com/ubuntu/ precise/universe libaugeas-ruby all 0.3.0-1.1ubuntu4 [3,354 B]
446Get:16 http://nova.clouds.archive.ubuntu.com/ubuntu/ precise/universe ruby-json amd64 1.6.3-1 [73.3 kB]
447Get:17 http://nova.clouds.archive.ubuntu.com/ubuntu/ precise/universe libjson-ruby all 1.6.3-1 [1,588 B]
448Get:18 http://nova.clouds.archive.ubuntu.com/ubuntu/ precise/main libruby all 4.8 [4,766 B]
449Get:19 http://nova.clouds.archive.ubuntu.com/ubuntu/ precise/main libshadow-ruby1.8 amd64 1.4.1-8build1 [9,416 B]
450 Fetched 3,900 kB in 8s (485 kB/s)
451 Selecting previously unselected package libreadline5.
452(Reading database ... 47507 files and directories currently installed.)
453 Unpacking libreadline5 (from .../libreadline5_5.2-11_amd64.deb) ...
454 Selecting previously unselected package augeas-lenses.
455 Unpacking augeas-lenses (from .../augeas-lenses_0.10.0-0ubuntu4_all.deb) ...
456 Selecting previously unselected package debconf-utils.
457 Unpacking debconf-utils (from .../debconf-utils_1.5.42ubuntu1_all.deb) ...
458 Selecting previously unselected package libruby1.8.
459 Unpacking libruby1.8 (from .../libruby1.8_1.8.7.352-2ubuntu1.4_amd64.deb) ...
460 Selecting previously unselected package ruby1.8.
461 Unpacking ruby1.8 (from .../ruby1.8_1.8.7.352-2ubuntu1.4_amd64.deb) ...
462 Selecting previously unselected package ruby.
463 Unpacking ruby (from .../apt/archives/ruby_4.8_all.deb) ...
464 Selecting previously unselected package virt-what.
465 Unpacking virt-what (from .../virt-what_1.11-1_amd64.deb) ...
466 Selecting previously unselected package facter.
467 Unpacking facter (from .../facter_2.0.1-1puppetlabs1_amd64.deb) ...
468 Selecting previously unselected package libaugeas0.
469 Unpacking libaugeas0 (from .../libaugeas0_0.10.0-0ubuntu4_amd64.deb) ...
470 Selecting previously unselected package libaugeas-ruby1.8.
471 Unpacking libaugeas-ruby1.8 (from .../libaugeas-ruby1.8_0.3.0-1.1ubuntu4_amd64.deb) ...
472 Selecting previously unselected package libaugeas-ruby.
473 Unpacking libaugeas-ruby (from .../libaugeas-ruby_0.3.0-1.1ubuntu4_all.deb) ...
474 Selecting previously unselected package ruby-json.
475 Unpacking ruby-json (from .../ruby-json_1.6.3-1_amd64.deb) ...
476 Selecting previously unselected package libjson-ruby.
477 Unpacking libjson-ruby (from .../libjson-ruby_1.6.3-1_all.deb) ...
478 Selecting previously unselected package libruby.
479 Unpacking libruby (from .../archives/libruby_4.8_all.deb) ...
480 Selecting previously unselected package libshadow-ruby1.8.
481 Unpacking libshadow-ruby1.8 (from .../libshadow-ruby1.8_1.4.1-8build1_amd64.deb) ...
482 Selecting previously unselected package hiera.
483 Unpacking hiera (from .../hiera_1.3.2-1puppetlabs1_all.deb) ...
484 Selecting previously unselected package ruby-rgen.
485 Unpacking ruby-rgen (from .../ruby-rgen_0.6.5-1puppetlabs1_all.deb) ...
486 Selecting previously unselected package puppet-common.
487 Unpacking puppet-common (from .../puppet-common_3.5.1-1puppetlabs1_all.deb) ...
488 Selecting previously unselected package puppet.
489 Unpacking puppet (from .../puppet_3.5.1-1puppetlabs1_all.deb) ...
490 Processing triggers for man-db ...
491 Processing triggers for ureadahead ...
492 Setting up libreadline5 (5.2-11) ...
493 Setting up augeas-lenses (0.10.0-0ubuntu4) ...
494 Setting up debconf-utils (1.5.42ubuntu1) ...
495 Setting up libruby1.8 (1.8.7.352-2ubuntu1.4) ...
496 Setting up ruby1.8 (1.8.7.352-2ubuntu1.4) ...
497update-alternatives: using /usr/bin/ruby1.8 to provide /usr/bin/ruby (ruby) in auto mode.
498 Setting up ruby (4.8) ...
499 Setting up virt-what (1.11-1) ...
500 Setting up facter (2.0.1-1puppetlabs1) ...
501 Setting up libaugeas0 (0.10.0-0ubuntu4) ...
502 Setting up libaugeas-ruby1.8 (0.3.0-1.1ubuntu4) ...
503 Setting up libaugeas-ruby (0.3.0-1.1ubuntu4) ...
504 Setting up ruby-json (1.6.3-1) ...
505 Setting up libjson-ruby (1.6.3-1) ...
506 Setting up libruby (4.8) ...
507 Setting up libshadow-ruby1.8 (1.4.1-8build1) ...
508 Setting up hiera (1.3.2-1puppetlabs1) ...
509 Setting up ruby-rgen (0.6.5-1puppetlabs1) ...
510 Setting up puppet-common (3.5.1-1puppetlabs1) ...
511 Setting up puppet (3.5.1-1puppetlabs1) ...
512 * Starting puppet agent
513 puppet not configured to start, please edit /etc/default/puppet to enable
514 [ OK ]
515 Processing triggers for libc-bin ...
516 ldconfig deferred processing now taking place
517-----> Installing Chef Omnibus to install busser to run tests
518 % Total % Received % Xferd Average Speed Time Time Time Current
519
520 Dload Upload Total Spent Left Speed
521 0 0 0 0
522100 15934 100 15934 0 0 14445 0 0:00:01 0:00:01 --:--:- - 19769
523sudo: unable to resolve host default-ubuntu-1204-ehaselwanter-cora
524 Downloading Chef for ubuntu...
525 downloading https://www.getchef.com/chef/metadata?v=&prerelease=false&nightlies=false&p=ubuntu&pv=12.04&m=x86_64
526 to file /tmp/install.sh.4090/metadata.txt
527 trying wget...
528 url https://opscode-omnibus-packages.s3.amazonaws.com/ubuntu/12.04/x86_64/chef_11.12.4-1_amd64.deb
529 md5 c45e1d4f7842af1048f788c4452d6cc0
530 sha256 595cd1e884efd21f8f5e34bdbe878421a9d5c1c24abd3c669a84e8ed261317a3
531 downloaded metadata file looks valid...
532 downloading https://opscode-omnibus-packages.s3.amazonaws.com/ubuntu/12.04/x86_64/chef_11.12.4-1_amd64.deb
533 to file /tmp/install.sh.4090/chef_11.12.4-1_amd64.deb
534 trying wget...
535 Comparing checksum with sha256sum...
536 Installing Chef
537 installing with dpkg...
538 Selecting previously unselected package chef.
539(Reading database ... 50163 files and directories currently installed.)
540 Unpacking chef (from .../chef_11.12.4-1_amd64.deb) ...
541 Setting up chef (11.12.4-1) ...
542 Thank you for installing Chef!
543sudo: unable to resolve host default-ubuntu-1204-ehaselwanter-cora
544 Transfering files to <default-ubuntu-1204>
545sudo: unable to resolve host default-ubuntu-1204-ehaselwanter-cora
546```bash
547
548installed :-) now converge ...
549
550```bash
551sudo: unable to resolve host default-ubuntu-1204-ehaselwanter-cora
552Warning: Config file /etc/puppet/hiera.yaml not found, using Hiera defaults
553Notice: Compiled catalog for default-ubuntu-1204-ehaselwanter-cora.openstacklocal in environment production in 1.90 seconds
554Notice: /Stage[main]/Ntp::Install/Package[ntp]/ensure: ensure changed 'purged' to 'present'
555Notice: /Stage[main]/Ntp::Config/File[/etc/ntp.conf]/content: content changed '{md5}32280703a4ba7aa1148c48895097ed07' to '{md5}29301de88a4464768ee3a4969989a448'
556Notice: /Stage[main]/Ntp::Service/Service[ntp]: Triggered 'refresh' from 1 events
557Notice: Finished catalog run in 49.96 seconds
558 Finished converging <default-ubuntu-1204> (6m12.75s).
559```bash
560
561and testing setup ...
562
563```bash
564-----> Setting up <default-ubuntu-1204>...
565sudo: unable to resolve host default-ubuntu-1204-ehaselwanter-cora
566sudo: unable to resolve host default-ubuntu-1204-ehaselwanter-cora
567Fetching: thor-0.19.0.gem (100%)
568Fetching: busser-0.6.2.gem (100%)
569Successfully installed thor-0.19.0
570Successfully installed busser-0.6.2
5712 gems installed
572sudo: unable to resolve host default-ubuntu-1204-ehaselwanter-cora
573-----> Setting up Busser
574 Creating BUSSER_ROOT in /tmp/busser
575 Creating busser binstub
576sudo: unable to resolve host default-ubuntu-1204-ehaselwanter-cora
577 Plugin bats installed (version 0.2.0)
578-----> Running postinstall for bats plugin
579 Installed Bats to /tmp/busser/vendor/bats/bin/bats
580 Plugin serverspec installed (version 0.2.6)
581-----> Running postinstall for serverspec plugin
582 Finished setting up <default-ubuntu-1204> (2m2.83s).
583-----> Verifying <default-ubuntu-1204>...
584sudo: unable to resolve host default-ubuntu-1204-ehaselwanter-cora
585 Suite path directory /tmp/busser/suites does not exist, skipping.
586sudo: unable to resolve host default-ubuntu-1204-ehaselwanter-cora
587 Uploading /tmp/busser/suites/bats/verify_installed.bats (mode=0644)
588sudo: unable to resolve host default-ubuntu-1204-ehaselwanter-cora
589sudo: unable to resolve host default-ubuntu-1204-ehaselwanter-cora
590sudo: unable to resolve host default-ubuntu-1204-ehaselwanter-cora
591sudo: unable to resolve host default-ubuntu-1204-ehaselwanter-cora
592 Uploading /tmp/busser/suites/serverspec/ntp_spec.rb (mode=0644)
593sudo: unable to resolve host default-ubuntu-1204-ehaselwanter-cora
594sudo: unable to resolve host default-ubuntu-1204-ehaselwanter-cora
595sudo: unable to resolve host default-ubuntu-1204-ehaselwanter-cora
596sudo: unable to resolve host default-ubuntu-1204-ehaselwanter-cora
597```bash
598
599and testing ...
600
601```bash
602-----> Running bats test suite
603 ✓ ntp is up and running
604 ✓ ntp.conf contains correct servers
605
6062 tests, 0 failures
607-----> Running serverspec test suite
608/opt/chef/embedded/bin/ruby -I/tmp/busser/suites/serverspec -S /opt/chef/embedded/bin/rspec /tmp/busser/suites/serverspec/ntp_spec.rb --color --format documentation
609
610Package "ntp"
611 should be installed
612
613Service "ntp"
614 should be enabled
615 should be running
616
617 Finished in 2.88 seconds
6183 examples, 0 failures
619 Finished verifying <default-ubuntu-1204> (0m28.04s).
620-----> Kitchen is finished. (8m45.06s)
621```bash
622
623## Common Errors
624
625- wrong flavor for image. especially the disk size must be able to hold the os of choice
626- wrong cloud user or cloud init not working.
627- ssh keys not accessible from kitchen
628- public IP not reachable by kitchen
629- cached value in .kitchen for provider (config change during same run e.g. ssh key path)
630
631```bash
632cat .kitchen/default-ubuntu-1204.yml
633---
634 server_id: f7b3177e-7056-4d44-9583-6bbaf8abb82e
635 hostname: "192.168.1.130"
636 ssh_key: /Users/ehaselwanter/.ssh/ci.key
637 last_action: verify%
638```bash
You are interested in our courses or you simply have a question that needs answering? You can contact us at anytime! We will do our best to answer all your questions.
Contact us