Class Rake::RemoteTask
In: lib/rake_remote_task.rb
Parent: Rake::Task

Rake::RemoteTask is a subclass of Rake::Task that adds remote_actions that execute in parallel on multiple hosts via ssh.

Methods

all_hosts   default_env   enhance   env   execute   fetch   host   hosts_for   new   remote_task   reset   role   roles   rsync   run   set   set_defaults   sudo   target_hosts   task   tasks  

Included Modules

Open4

Classes and Modules

Class Rake::RemoteTask::Action

External Aliases

enhance -> original_enhance
  Add a local action to this task. This calls Rake::Task#enhance.

Attributes

options  [RW]  Options for execution of this task.
remote_actions  [R]  An Array of Actions this host will perform during execution. Use enhance to add new actions to a task.
target_host  [RW]  The host this task is running on during execution.

Public Class methods

Returns an Array with every host configured.

The default environment values. Used for resetting (mostly for tests).

The vlad environment.

Fetches environment variable name from the environment using default default.

Add host host_name that belongs to roles. Extra arguments may be specified for the host as a hash as the last argument.

host is the inversion of role:

  host 'db1.example.com', :db, :master_db

Is equivalent to:

  role :db, 'db1.example.com'
  role :master_db, 'db1.example.com'

Returns an Array of all hosts in roles.

Create a new task named task_name attached to Rake::Application app.

Adds a remote task named name with options options that will execute block.

Resets vlad, restoring all roles, tasks and environment variables to the defaults.

Adds role role_name with host and args for that host.

The configured roles.

Set environment variable name to value or default_block.

If default_block is defined, the block will be executed the first time the variable is fetched, and the value will be used for every subsequent fetch.

Sets all the default values. Should only be called once. Use reset if you need to restore values.

The Rake::RemoteTask executing in this Thread.

The configured Rake::RemoteTasks.

Public Instance methods

Add remote action block to this task with dependencies deps. See Rake::Task#enhance.

Execute this action. Local actions will be performed first, then remote actions will be performed in parallel on each host configured for this RemoteTask.

Use rsync to send local to remote on target_host.

Use ssh to execute command on target_host. If command uses sudo, the sudo password will be prompted for then saved for subsequent sudo commands.

Execute command under sudo using run.

The hosts this task will execute on. The hosts are determined from the role this task belongs to.

The target hosts may be overridden by providing a comma-separated list of commands to the HOSTS environment variable:

  rake my_task HOSTS=app1.example.com,app2.example.com

[Validate]