[edit on GitHub]

Use the machine_execute resource to run a command on a remote machine in much the same way the execute resource is used to run a command on a local machine.


This functionality is available with Chef provisioning and is packaged in the Chef development kit. Chef provisioning is a framework that allows clusters to be managed by the chef-client and the Chef server in the same way nodes are managed: with recipes. Use Chef provisioning to describe, version, deploy, and manage clusters of any size and complexity using a common set of tools.


The syntax for using the machine_execute resource in a recipe is as follows:

machine_execute 'name' do
  attribute 'value' # see properties section below
  action :action # see actions section below


  • machine_execute tells the chef-client to use the Chef::Provider::MachineExecute provider during the chef-client run
  • name is the name of the resource block; when the command property is not specified as part of a recipe, name is also the command to be run
  • attribute is zero (or more) of the properties that are available for this resource
  • action identifies which steps the chef-client will take to bring the node into the desired state


This resource has the following actions:

This resource block does not act unless notified by another resource to take action. Once notified, this resource block either runs immediately or is queued up to run at the end of the Chef Client run.
Default. Use to run a machine.


This resource has the following properties:


Ruby Type: Hash

The URL for the Chef server.


Ruby Type: String

The name of the command to be executed. Default value: the name of the resource block. See “Syntax” section above for more information.


Ruby Type: Chef::Provisioning::Driver

Use to specify the driver to be used for provisioning.

Ruby Type: true, false | Default Value: false

Ruby Type: String

Use to specify the machine type.