Information Technology Reference
In-Depth Information
$
kitchen converge default-centos65
Now, let's get to some coding. First, let's use the
package
resource to install the
httpd
pack-
Example 7-10. chefdk/apache/recipes/default.rb
#
# Cookbook Name:: apache
# Recipe:: default
#
# Copyright (C) 2014
#
#
#
package
"httpd"
ddo
action
:install
end
end
Run
kitchen converge
again to check your work. We also encourage you to use
kitchen
login
to inspect the node to verify that your recipe is doing what you expect. Log in to the
node, and verify that the
httpd
service is installed with the following command. Be sure to
exit back out to your host prompt when you are done:
$
kitchen converge default-centos65
$
kitchen login default-centos65
Last login: Thu Aug 14 13:48:32 2014 from 10.0.2.2
Welcome to your Packer-built virtual machine.
[vagrant@default-centos65 ~]$
rpm -q httpd
httpd-2.2.15-31.el6.centos.x86_64
[vagrant@default-centos65 ~]$
exit
logout
Connection to 127.0.0.1 closed.
The
httpd
service is indeed installed! The
rpm -q
command queries the rpm package man-
ager database to see if a package containing the name is present on the system.
providers
based on the
platform
and
platform_family
returned by
ohai
. Because our
platform
is
rhel
, the
yum_package
provider is used.