Understanding recipes
As we have already discussed, recipes are fundamental units of cookbooks and contain step-by-step instructions to configure the machine.
Our goal is to install WordPress, PHP, and Apache2. There are some defined tasks when we install any Linux distribution. The most common task is to update the packages of an operating system. An apt
cookbook provides us with the facility to update packages automatically. We will include an apt
cookbook to ensure that all the packages are updated.
Open the metadata.rb
file in wpblog
and add the following dependencies:
depends 'rvm' depends 'apt' depends 'apache2' depends 'php' depends 'mysql'
Let's include the php
, mysql
, and apache2
recipes in our wpblog
recipe and provision the machine.
The final code of default.rb
will look like the following lines of code:
include_recipe "apt" include_recipe "apache2" include_recipe "apache2::mod_php5" include_recipe "mysql::client" include_recipe "mysql::server" include_recipe...