// START SNIPPET task-rule
tasks.addRule("Pattern: ping<ID>") { String taskName ->
    if (taskName.startsWith("ping")) {
        task(taskName) << {
            println "Pinging: " + (taskName - 'ping')
        }
    }
}
// END SNIPPET task-rule

task groupPing {
    dependsOn pingServer1, pingServer2
}