Skip to content

Instantly share code, notes, and snippets.

@krimdomu
Created February 28, 2014 15:25
Show Gist options
  • Save krimdomu/9272971 to your computer and use it in GitHub Desktop.
Save krimdomu/9272971 to your computer and use it in GitHub Desktop.
calling tasks
task "run", "host1", sub {
# run task "prepare" on the current ssh connection
prepare();
# run task "start_services" on the current ssh connection
start_services();
# create a new connection, to the server defined in the task definition
# and run the task prepare
do_task "prepare";
# create a new connection, to the server defined in the task definition
# and run the task start_services
do_task "start_services";
# if the task returns something, there is run_task
# create a new connection to "host1", run the task and collect the return value.
my $return = run_task "prepare", on => "host1";
};
task "prepare", "host1", sub {
file "/etc/httpd/conf.d/25-vhost.conf",
content => template("vhost.conf.tpl", vhosts => ['www.rexify.org']);
};
task "start_services", "host1", sub {
service httpd => "start";
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment