Jenkins Plugins

Jenkins Plugins are very important part of CI/CD tool Jenkin. 
By default Jenkins has lot of functionality but if you want to
add more functionality to perform the tasks then you can go
ahead and install its Plugins. These are open source and can be
installed automatically via Jenkins GUI or it can also be
installed manually by downloading required plugins.

Let’s install it via GUI first.

Click on Manage Jenkins.
It will redirect you to a page where you will have lot of 
options to manage Jenkins. Click on “Plugins” here and it will
open a page for you.
Please have a look to the image above you will find options 
like Available Plugins, Installed Plugins etc. You can use
these options to manage plugins.

If you want to see installed plugin then just click on
installed plugins.
From above image you can see all installed plugins. There is 
also option to enable or disable the plugins. Now let’s install
a plugin. I want to install a plugin which helps me to perform
Ansible tasks. I have searched for Ansible. I got two option
one is Ansible while other one is Ansible Tower. I will select
“Ansible” and Click on install.
You can also restart it while installing Jenkins Plugins. But 
make sure at that moment no jobs are running.
Now you can go ahead to Installed Plugins section and you will 
find it there enabled.
You have Ansible functionality in Jenkins. Try to push adhoc 
command or run playbooks. You can click on Ansible Plugin to
check more details about it. Below is the redirected link of
Ansible Plugin.

https://plugins.jenkins.io/ansible/

Now let’s try to install by downloading plugin package and
install it via GUI. We will uninstall the above Ansible plugin
first and reinstall it by other method.

You need to go to Installed Plugin option and Click on (X) sign
with installed plugin.
It will prompt you for confirmation and click on Yes. It will 
uninstall it. You need to restart the Jenkins Service.

Open the Jenkins Plugins website and search for Ansible
Plugins. I reached at:

https://plugins.jenkins.io/ansible/

On the above URL you will get an option “How to install”. Click
on it. It will show you three option and here we are going with
third option “Using direct upload”.
When you click on the option, it will open a page where all 
release are available. Download the desired one. The downloaded
file will have .hpi extension.

Now login to Jenkins and again go to Manage Jenkins -> Plugins
-> Advanced Settings. Now upload the file and click on deploy.
You can see in Installed Plugin now that Ansible is there.
Note: The most important thing while installing Jenkins Plugin 
manually is that the dependencies related to plugins need to be
installed by you as well.


There is also a method where you can download the *.hpi file
and move it to Jenkins Plugin location “/var/lib/jenkins/
plugins”
and rename it *.jpi extensions. Now restart Jenkins
and it will show as installed plugin.

The final way of installation of Plugin is by using “Jenkins
CLI”.
There is an option in “Manage Jenkins” from where you can
take help of Jenkins CLI. Now let’s install a Jenkin Plugin via
CLI.

As of now, we don’t have Jenkins-cli. So we will install it
first after downloading it.
I have uploaded file to /var/lib/jenkins/ and will install it 
from here.
# java -jar jenkins-cli.jar -s http://192.168.64.205:8080/ who-am-i
Authenticated as: anonymous
Authorities:
  Anonymous
As you can see that user is showing as Anonymous so we need to 
provide user for authentication. We will provide username and
password.
# java -jar jenkins-cli.jar -s http://192.168.64.205:8080/ -auth username:password who-am-i
Authenticated as: varelite
Authorities:
  authenticated
Now you can use install-plugin as well.
# java -jar jenkins-cli.jar -s http://192.168.64.205:8080/ -auth varelite:qwerty install-plugin ansible:403.v8d0ca_dcb_b_502
Installing ansible:403.v8d0ca_dcb_b_502 from update center
The last step is to restart Jenkins via command line.
# java -jar jenkins-cli.jar -s http://192.168.64.205:8080/ -auth varelite:qwerty  safe-restart
Check service now:
# systemctl status jenkins
● jenkins.service - Jenkins Continuous Integration Server
     Loaded: loaded (/usr/lib/systemd/system/jenkins.service; enabled; preset: disabled)
     Active: active (running) since Sat 2024-06-22 10:13:03 IST; 52ms ago
   Main PID: 777623 (java)
Now you can check via GUI. It will be there as installed.

Leave a Reply

Your email address will not be published. Required fields are marked *