Ansible Jenkins Integration | Jenkins Pipeline script to execute Ansible Playbook

แชร์
ฝัง
  • เผยแพร่เมื่อ 15 ก.ย. 2024
  • Ansible Jenkins Integration | Jenkins Pipeline script to execute Ansible Playbook
    Integrate Ansible in Jenkins and execute the playbook by writing the Pipeline script.
    To integrate ansible in Jenkins we need ansible plugin to installed in the Jenkins server.
    #devops #devopsproject #devopstutorial #devopstraining #devopsforbeginners #automation #ansible
    SUBSCRIBE my channel:
    / @ranjitswain
    : FOLLOW ME :
    Instagram - / rs.ranjitswain
    Facebook - / ranjit.swain.9
    Twitter - / rs_ranjitswain

ความคิดเห็น • 37

  • @songterence4186
    @songterence4186 11 หลายเดือนก่อน +1

    Mr Ran, that's an awesome explanation. I enjoy watching your videos because you explicitly ensure they are easily understood by everyone.

    • @RanjitSwain
      @RanjitSwain  10 หลายเดือนก่อน

      Thank you for your valuable comment! I'm glad it helped you.

  • @shamshadansari2018
    @shamshadansari2018 11 หลายเดือนก่อน

    after watching this nexus tutorial. i am your new subscriber Sir.. Thanks so much.. I was looking for nexus with jenkins

    • @RanjitSwain
      @RanjitSwain  11 หลายเดือนก่อน

      Thanks 🙏

  • @syamkumar7751
    @syamkumar7751 ปีที่แล้ว +2

    Awesome session 🎉

  • @SUBHAMisliveBGMI
    @SUBHAMisliveBGMI ปีที่แล้ว +1

    Nicely Explained ...👌

  • @gouravrelhan7372
    @gouravrelhan7372 หลายเดือนก่อน

    Thank you so much . . I have multiple .yml files in which multiple roles are defined. So do we need to put abc.yml, def.yml like this comma separated? and put the inventory file path. Right and rest of the files in ansible jenkins will take by default? Is that correct?

    • @RanjitSwain
      @RanjitSwain  หลายเดือนก่อน

      Hi @gouravrelhan7372, you can call multiple roles like this:
      roles:
      - role:
      name: myrole1
      vars:
      host: "db1"
      myroles:
      - mysql1
      - apache1
      - role:
      name: myrole2
      vars:
      host: "db2"
      myroles:
      - mysql2
      - apache2

  • @vishalvaishnav5856
    @vishalvaishnav5856 ปีที่แล้ว +1

    Directly we can’t use ansible commands in Jenkins pipeline every time we have to use generator?

    • @RanjitSwain
      @RanjitSwain  ปีที่แล้ว

      Hi, here it is just explained how we can use the Ansible plugin in Jenkins to integrate. Yes, off course we can use Ansible commands directly in the pipeline to execute the playbook.

  • @jubriladeyi5291
    @jubriladeyi5291 ปีที่แล้ว +1

    should ansible be installed on the server where the jenkins runs from or on the server/docker-container used as agent?

    • @RanjitSwain
      @RanjitSwain  ปีที่แล้ว

      Hi, it’s up to you how you want to setup both ways it will work.

    • @237311
      @237311 ปีที่แล้ว

      @@RanjitSwain If let say I have the Ansible server installed in a separate box. How can I point the Jenkins pipeline script to execute the playbook from the Ansible server? What is the correct syntax to the Inventory file path of the remote Ansible server? Thanks

    • @237311
      @237311 ปีที่แล้ว +1

      I found out that the fields "Playbook file path in workspace" and "Inventory file path in workspace" are typically used when your Ansible playbook and inventory files are located within the Jenkins workspace.

    • @237311
      @237311 ปีที่แล้ว

      The only issue I have is how to specify the SSH credentials ID for my Ansible server in the Pipeline script. Do you have any ideas on how to do that?

  • @237311
    @237311 ปีที่แล้ว

    After installing the Ansible plugin on the Jenkins server, it seems that the Ansible executable directory is located at '/var/lib/jenkins/plugins/'.

    • @RanjitSwain
      @RanjitSwain  ปีที่แล้ว

      Hi, no, it's not the Ansible executable directory. That is the plugins directory of Jenkins.
      You can execute a playbook from anywhere followed by the absolute path of the playbook

  • @anjaliadhikari4673
    @anjaliadhikari4673 4 หลายเดือนก่อน

    I am expecting your reply. I am a student .I have my master machine and worker machine and enabled passwordless ssh connection. When i create a job to execute playbook on jenkins. I have chosen build step and shell command i have specified the absoulete path to my playbook which resides on master machine and that playbook should be executed in my worker machine. Manually it gets executed and when i run on jenkins i get permission denied issue. I cannot give read permission to any other user or group for id_rsa it throws error "bad permission" if i don't set permission to jenkins than how can it access the private key? I have also set the user and private key in jenkins under manage credentials but still that is throwing same error.. any help would be appreciated, Thank you

    • @RanjitSwain
      @RanjitSwain  3 หลายเดือนก่อน

      Hi @anjaliadhikari4673, sorry for the late reply. You first need to setup the connectivity between ansible and Jenkins server. Also to work on different server you should use the key to connect to that server.

  • @bsk8643
    @bsk8643 6 หลายเดือนก่อน

    We have a tower job which we execute from ansible.. is it possible to auto trigger the tower job using jenkins ? I am new to this so not sure if tower job is the one which executes playbook .. pls confirm

    • @RanjitSwain
      @RanjitSwain  6 หลายเดือนก่อน

      Hi @bsk8643, yes, the tower job in Ansible tower executes the playbook.
      You can use "Ansible Tower" plugin in Jenkins to trigger tower jobs or, playbooks.

  • @ganeshrajput5925
    @ganeshrajput5925 ปีที่แล้ว

    Really helpful 👍

  • @EntertainmentHouse377
    @EntertainmentHouse377 11 หลายเดือนก่อน

    Hi sir.. Your session are always helpful to me.. But i have one question in this session.. Where i can find my private key

    • @RanjitSwain
      @RanjitSwain  11 หลายเดือนก่อน

      Hi @EntertainmentHouse377, the private key file is the one which you create during the EC2 instance creation.

  • @sagarsriva
    @sagarsriva ปีที่แล้ว

    great video

  • @nareshbabuy8530
    @nareshbabuy8530 ปีที่แล้ว

    sir please make a video on Jenkins-ansible-docker with separate servers for deploying a war file or jar file

    • @RanjitSwain
      @RanjitSwain  ปีที่แล้ว

      Hi Naresh, Thanks for your nice suggestion! I will make one shortly.

    • @nareshbabuy8530
      @nareshbabuy8530 ปีที่แล้ว

      Tq so much sir for ur response and reply

  • @naren06938
    @naren06938 ปีที่แล้ว +1

    Sir, why u r always skipping some tasks, already installed, Alrdy server created, already configured....etc, Plsss make videos from scratch i.e. From EC2 preparation....then easy for us to practice ur videos.....

    • @RanjitSwain
      @RanjitSwain  ปีที่แล้ว

      Dear Narendra, this video was made for who has some basic ideas on server creation and all.
      Thanks for your suggestions, In my upcoming videos I’ll keep this basics for the people who are completely new.

  • @WasimBuden
    @WasimBuden ปีที่แล้ว

    For newcomers, it may not be beneficial to omit the section on setting up authentication between Jenkins and a remote server, as it is crucial for resolving pipeline failures.

    • @RanjitSwain
      @RanjitSwain  ปีที่แล้ว +1

      Hi, thanks for your valuable comment. Here is the link below on setting up authentication between Jenkins and a remote server.
      th-cam.com/video/03DP_P-A5jM/w-d-xo.html