In our previous article, we learned how to Ansible to be configured on Jenkins Master to run Ansible job. In this article, we will learn how to run Ansible Playbook through Jenkins by Executing Shell Command.
Then provide a name for Enter an item name field & choose Freestyle project option
Then click on Ok button
After that it will redirect you to the Job Configure section. In that section navigate to Build section and choose Execute Shell as Add build step option
After that, in command section paste below command
(As an example, we are going use /home/ubuntu/ansible-playbook/ansible.yml as Playbook path because my Playbook is located at that directory)
Save the Job and click on Build Now
Verify the Console log
What's next
In our next tutorial we are going to learn Run Ansible Playbook from Jenkins With a Dedicated User and Jenkins Node
Conclusion
In this tutorial, we learned how to run Ansible Playbook using Jenkins. If you have any issue regarding this tutorial, mention your issue in comment section or reach me through my E-mail. You can obtain all the related script files for this tutorial from this GitHub repository.