Created
February 28, 2014 15:25
-
-
Save krimdomu/9272971 to your computer and use it in GitHub Desktop.
calling tasks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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