Skip to content

Instantly share code, notes, and snippets.

@krimdomu
Created February 22, 2013 09:53
Show Gist options
  • Save krimdomu/5012195 to your computer and use it in GitHub Desktop.
Save krimdomu/5012195 to your computer and use it in GitHub Desktop.
get the servers out of a group
group mygroup => "srv01", "web[01..10]";
task "test", sub {
my @servers = get_servers("mygroup");
for my $srv (@servers) {
run_task "foo", on => $srv, params => { param1 => "value1", param2 => "value2" };
}
};
sub get_servers {
my ($group) = @_;
my @servers = Rex::Group->get_group($group);
return map { $_->get_servers } @servers;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment