I was hoping this simple script would be enough:
import java.net.* for (slave in Jenkins.instance.slaves) { host = slave.computer.hostName addr = InetAddress.getAllByName(host) println slave.name + ": " + addr.hostAddress }
But, at least with my installation, this does not give me the result that I want on systems with multiple network interfaces.
You can use the “run the command on the slave” technique from the answer to “How to execute the system command on the remote node” to run something like /sbin/ifconfig on each slave device. This will certainly give you the details, but I don't have Groovy savvy to write an output parser for extracting IP addresses.
source share