Jenkins - Configure Jenkins Job for Package Installation - Jenkins slow and how to add the ssh part

Hello

Can someone explain to me how to add natasja to the ssh part so I can finally solve this one.

Jenkins is very slow . Anyone can explain why ?

Can you give us the Task Number and Level please?

Level 1 , task 5 of the Jenkins path

Configure Jenkins Job for Package Installation

After you install the parameter plugin the rest can be done in bash. What part are you stuck on? You can use sshpass with ssh to run an inline script which runs yum as root using sudo.

O, Im stuck how I can tell Jenkins how to make a ssh connnection to the storage server.
I thought that needed to do in Jenkins somehow and seen it somewhere

You can do it in Jenkins using a plugin, or you can do it all in bash.

oke
I tried it with Jenkins and did this :

but the build failed with this :

Started by user admin
Running as SYSTEM
Building in workspace /var/lib/jenkins/workspace/install-packages
[SSH] script:
PACKAGE="httpd"

sudo yum install $PACKAGE

[SSH] executing...

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.

sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper
sudo: a password is required

[SSH] completed
[SSH] exit-status: 1

Build step 'Execute shell script on remote host using ssh' marked build as failure
Finished: FAILURE

The error tells you what to do. Run sudo with the -S parameter. Before that pipe the output of echo <password> to the sudo yum command.

exact line would be “echo ‘your_password’ | sudo -S yum install -y $PACKAGE”

I have installed the following plugins :

  1. Credentials
  2. Plain Credentials
  3. SSH Agent Plugin
  4. SSH Credentials Plugin
  5. SSH Plugin
  6. Credentials Binding Plugin

I tried to add a SSH Remote Hosts with the following values:
Hostname=ststor01
Port=22

but when i tried to Add new Credentials with the only option : Jenkins Credential Provider ,
Domain = Global Credentials
Kind = username with password
scope = Global
Username = natasha
Password = i inserted correctly here
ID = leave it blank
Description = leave it blank

It throw the error message : Credentials creation failed.

i tried to perform below from jumphost server

ssh Natasha@ststor01

i entered the correct password , but it was rejected , is the account locked out ?

  1. need to add credentials first using Under Jenkins > Manage Jenkins > Manage Credentials, click Global under Stores scoped to Jenkins and Add Credentials

need to specify ID = storage

  1. when adding SSH host using Click Jenkins > Manage Jenkins > Configure System

need to specify full host name = Hostname = ststor01.stratos.xfusioncorp.com

  1. when adding a Build Step using
    Under Build add a Build Step with Execute shell script on remote host using SSH and under SSH Site

specify this : echo ‘Bl@kW’ | sudo -S yum install -y $PACKAGE

Credit to Jenkins Install Packages Kodekloud | Add string parameter named PACKAGE