Skip to content
Ryota Arai edited this page Mar 14, 2017 · 4 revisions

Itamae has Chef-like definitions feature.

You can define definition with a collection of multiple resources, like:

define :install_and_enable_package, version: nil do
  v = params[:version]
  package params[:name] do
    version v if v
    action :install
  end

  service params[:name] do
    action :enable
  end
end

Then, you can use it:

install_and_enable_package 'nginx' do
  version '1.6.1'
end

Note that a define should be done before using the defined resource.