Skip to content

Instantly share code, notes, and snippets.

@elyezer
Last active August 29, 2015 14:05
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elyezer/ba525fd62c313f8f5eb8 to your computer and use it in GitHub Desktop.
Save elyezer/ba525fd62c313f8f5eb8 to your computer and use it in GitHub Desktop.

How to configure a jenkins slave. On the slave setup a jenkins user and add the master SSH public key on the authorized_keys file.

useradd -m jenkins
su - jenkins -c "mkdir /home/jenkins/.ssh"
su - jenkins -c "chmod 700 ~/.ssh"
su - jenkins -c "chmod 600 ~/.ssh/*"
su - jenkins -c "restorecon -R -v ~/.ssh"
su - jenkins -c "vim /home/jenkins/.ssh/authorized_keys"

Now the master Jenkins client can ssh to the slave without a password. Next configure the Jenkins master to connect to the slave. Head over to the Master environment and navigate to "Manage Jenkins" and then "Manage Nodes". Click "New Node" in the sidebar and add a Dumb Slave. On the following page, fill in the following fields:

  • Name: give a name for slave
  • of executors: 2 (controls the number of concurrent builds, one per core should be a good number)

  • Remote FS root: /home/jenkins
  • Labels: python27 ...
  • Usage: Utilize this node as much as possible
  • Launch method: Launch slave agents on Unix machines via SSH. Also fill in the Host field with the address of your slave machine. And add a credential if necessary.

References:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment