execute resource with examples and alternatives in Chef

This is a resource that actually lets us to execute some script or some contents of a script inside of our actual Chef recipes. It provides compatibility across multiple Unix systems.

Example1: execute with inline script

execute "run a script" do
  user "root"
  command <<-EOL
  mkdir -p /var/www/mysites/
  chown -R www-data /var/www/mysites
  EOL
  not_if do
    File.directory?('/var/www/mysites')
  end
end

Example2: execute with calling the script directly
execute "run script"
  user "root"
  command "./myscript.sh"
  not_if
  ...
end

Example 3: alternative to the Example 1
directory "/var/www/mysites" do
  owner "www-data"
  recursive true
  mode ...
end