Carried on from CHEF configure MySQL on AWS EC2 Ubuntu

We want to setup each new WordPress build with the latest version so we’ll fetch it from But how? Fortunately enough, Chef comes with the resource remote_file which will do just that for us.

cd cookbooks/phpapp

vi recipes/default.rb # and add the following lines

wordpress_latest = Chef::Config[:file_cache_path] + “/wordpress-latest.tar.gz”

remote_file wordpress_latest do

source “”

mode “0644”


directory node[“phpapp”][“path”] do

owner “root”

group “root”

mode “0755”

action :create

recursive true


execute “untar-wordpress” do

cwd node[‘phpapp’][‘path’]

command “tar –strip-components 1 -xzf ” + wordpress_latest

creates node[‘phpapp’][‘path’] + “/wp-settings.php”



vi attributes/default.rb # and add the following
default[“phpapp”][“path”] = “/var/www/phpapp”

cd ../..
chef-solo -c solo.rb -j web.json