http://localhost:8080).HelloMaven-CI. Don’t change the project name (if a project with this name already exists then delete the existing project),
Scroll to the "Source Code Management" Section:
https://github.com/devops-ds/your-maven-project.git*/main or */master). Use */main if you are using above link.
Scroll Down to the "Build" Section.
Add the Maven Build Step: Click "Add build step" and select "Execute shell".
Configure the Shell Command:
To find the full path to your mvn executable on open terminal in Ubuntu and run:
which mvn

The output will give you the full path (e.g., /usr/bin/mvn or /opt/maven/bin/mvn). Use this path in the command below in Jenkins Build Action Shell.
#/path/to/your/maven/bin/mvn clean package
# Example:
/usr/bin/mvn clean package
Add the Ansible Deployment Step: Click "Add build step" again and select "Execute shell" (or "Execute Windows batch command" on Windows).
Configure the Shell Command: In the command box, add a command to trigger your Ansible playbook.
Note: It is highly recommended to upload your hosts.ini and deploy.yml files to your GitHub repository alongside your project code. This simplifies referencing them in Jenkins and keeps your automation code version-controlled.
If your files are in the root of your repository (follow this command if you are using given github link), the command would be:
ansible-playbook -i hosts.ini deploy.yml
If you are not storing them in GitHub, use the full paths:
ansible-playbook -i /path/to/hosts.ini /path/to/deploy.yml
Note:
/path/to/hosts.ini with the full path to your Ansible inventory file if not in GitHub./path/to/deploy.yml with the full path to your Ansible deployment playbook if not in GitHub.