Information Technology Reference
In-Depth Information
In order to execute the chef-server-ctl reconfigure , we need to introduce another re-
source, the execute resource. When you fail to find a resource that meets your needs, you
can use the execute resource to run arbitrary shell commands. Pass the shell command you
want to execute as a string parameter to the execute resource.
The full code is in Example A-3 .
Example A-3. /chefdk/chef-repo/cookbooks/chef-server/recipes/default.rb
#
# Cookbook Name:: chef-server
# Recipe:: default
#
# Copyright (C) 2014
#
#
#
package_url = node [ 'chef-server' ][ 'url' ]
package_name = :: File . basename ( package_url )
package_local_path = " #{ Chef : :Config [ :file_cache_path ] } / #{ package_name } "
# omnibus_package is remote (i.e., a URL) let's download it
remote_file package_local_path ddo
source package_url
end
end
package package_local_path
# reconfigure the installation
execute 'chef-server-ctl reconfigure'
Run kitchen converge to install Chef Server, and use kitchen login to verify that the
chef-server package was installed:
$ kitchen converge default-centos65
$ kitchen login default-centos65
[vagrant@default-centos65 ~]$ rpm -q chef-server
chef-server-11.1.4-1.el6.x86_64
[vagrant@default-centos65 ~]$ exit
logout
Connection to 127.0.0.1 closed.
Search WWH ::




Custom Search