Mike A
Mike A

Reputation: 510

How to get the host name or ip of a ssh slave node in Jenkins with groovy

I am running a Jenkins server with multiple slave nodes, all of which use the SSH Slaves plugin to launch jobs. I am trying to get a simple Groovy script to run through all the nodes and report the Host entry in the SSH Slaves config. My groovy skills are not very good and I'm not really an OO guy, so I can't figure it out.

Upvotes: 1

Views: 1624

Answers (1)

Mike A
Mike A

Reputation: 510

for (aSlave in hudson.model.Hudson.instance.slaves) {
  println('====================');
  println "${aSlave.name}: \t ${aSlave.getLauncher().getHost()}";
}

Upvotes: 1

Related Questions