100 Days of DevOps — Day 61-Jenkins Agent Node

Requirement

Step1: Install the necessary package on the agent node

yum -y install java-1.8.0-openjdk git

Step2: Create user and copy the ssh key from Master to agent node

# useradd jenkinsvisudojenkins ALL=(ALL)       NOPASSWD: ALL# mkdir jenkins_build
$ ssh-copy-id jenkins@172.31.29.138# To test the connectivity$ ssh jenkins@172.31.29.138Last login: Fri Apr 12 04:31:49 2019

Step3: Add the agent from Jenkins UI

* Name: Give your agent some name
* # of executors: The maximum number of concurrent builds that Jenkins may perform on this node.
* Remote root directory:An agent needs to have a directory dedicated to Jenkins. Specify the path to this directory on the agent. It is best to use an absolute path, such as /var/jenkins or c:\jenkins. This should be a path local to the agent machine. There is no need for this path to be visible from the master(/var/lib/jenkins/jenkins_build) created in earlier step
* Usage: Controls how Jenkins schedules builds on this node.
Use this node as much as possible - This is the default setting.
In this mode, Jenkins uses this node freely. Whenever there is a build that can be done by using this node, Jenkins will use it.
* Credentials: Select the credentials to be used for logging in to the remote host.
* Host: Enter the hostname or IP address of your agent node in the Host field.
* 
* Restrict where this project can be run: Select the label we created in earlier step(jenkins_slave) this will make sure build run on agent host

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Prashant Lakhera

Prashant Lakhera

AWS Community Builder, Ex-Redhat, Author, Blogger, YouTuber, RHCA, RHCDS, RHCE, Docker Certified,4XAWS, CCNA, MCP, Certified Jenkins, Terraform Certified, 1XGCP