Epligam
Epligam

Reputation: 783

Create Jenkins slave from command line

I have a script that create a VM then I need to add the new VM as a slave to existing master,
How can I do that from command line in windows and from the new VM ?

Upvotes: 2

Views: 2433

Answers (1)

Muhammad Faizan-Ul-Haq
Muhammad Faizan-Ul-Haq

Reputation: 340

Create a VM (OS = WINDOWS)

Create a Node on jenkins server from command line using jenkins cli:

config.xml | ssh -l fmud -p %JNLP_PORT% %jenkins_IPADDRESS% create-node %TARGET_WIN_NODE_NAME% 

Where Config.xml could be gathered from an existing slave with command:

ssh -l fmud -p %JNLP_PORT% %jenkins_IPADDRESS% get-node %TARGET_WIN_NODE_NAME%

Note: JNLP is needed for jenkins-CLI and could be configured in jenkins administrative page.

Also, you will have to change the config file with label and name etc.

If it is a java slave, that is simple to automate. Like it if you find it helping or ask more specific question otherwise.

Upvotes: 1

Related Questions