Automating package installations across target infrastructure nodes is a core capability of Continuous Integration and Continuous Deployment (CI/CD) pipelines. Jenkins enables infrastructure engineers to execute remote maintenance and deployment tasks securely via parameterized Freestyle Projects.
By configuring parameterized jobs, users can specify dynamic variables (such as package names or application versions) at runtime without editing the job’s underlying build script configuration.
This implementation involves:
PACKAGE string parameter in the Jenkins user interface.ssh -o StrictHostKeyChecking=no) to open an automated remote shell session on the Storage Server (ststor01).sudo dnf install -y $PACKAGE) on the target host non-interactively.graph TD
subgraph ClientLayer ["Client / Operator"]
User["DevOps Engineer"]
end
subgraph JenkinsController ["Jenkins Controller"]
UI["Jenkins Web Interface"]
JobConfig["Freestyle Job: install-packages"]
EnvVar["Environment Variable: $PACKAGE"]
BuildStep["Execute Shell Build Step"]
end
subgraph TargetHost ["Storage Server (ststor01)"]
SSHDaemon["SSH Daemon (User: natasha)"]
Sudoers["Sudoers Policy (Passwordless)"]
DNF["DNF Package Manager"]
end
User -->|1. Select 'Build with Parameters'| UI
UI -->|2. Supply PACKAGE name e.g. vim-enhanced| JobConfig
JobConfig -->|3. Populate Variable| EnvVar
EnvVar -->|4. Execute Command| BuildStep
BuildStep -->|5. SSH Connection| SSHDaemon
SSHDaemon -->|6. Escalate Privileges| Sudoers
Sudoers -->|7. Install Package| DNF
When the “This project is parameterized” option is enabled in a Jenkins Freestyle project:
PACKAGE becomes available inside the build container/shell execution context as $PACKAGE.Remote execution requires non-interactive shell commands:
StrictHostKeyChecking=no): Prevents the SSH client from hanging indefinitely waiting for an interactive user confirmation when encountering a new host fingerprint.ssh user@host "command"): Passes the remote command string directly to the target server’s SSH daemon for execution, returning standard output and error streams back to Jenkins.natasha) must have non-interactive passwordless sudo privileges configured in /etc/sudoers on ststor01 (natasha ALL=(ALL) NOPASSWD: ALL).8080admin / Adm!n321ststor01natashainstall-packagesPACKAGEpackage to installssh -o StrictHostKeyChecking=no natasha@ststor01 "sudo dnf install -y $PACKAGE"adminAdm!n321
install-packages Freestyle Jobinstall-packages.
PACKAGEpackage to install
ssh -o StrictHostKeyChecking=no natasha@ststor01 "sudo dnf install -y $PACKAGE"

install-packages project page, click Build with Parameters.vim-enhanced).
#1 will start executing:
SUCCESS):
#1 and select Console Output from the left menu./bin/sh executing the SSH command.ststor01 as user natasha.vim-enhanced along with its dependencies (gpm-libs, vim-common, vim-filesystem).Finished: SUCCESS.
The Jenkins package installation job is now fully configured and verified!