Running a playbook using Ansible on Jenkins

0 votes

I am trying to run an Ansible playbook via Jenkins

    - hosts: all
  tasks:
    - name: Print message
      debug: msg="Hello number 2 from Ansible!!"
    - name: ping all hosts
      ping:
    - debug: var=ansible_all_ipv4_addresses
    - name: Update the repository cache and update package "nginx" to latest version using default release squeeze-backport
      apt:
        name: nginx
        state: latest
        update_cache: yes
    - name: Copy config files for nginx
      copy:
        src: ./Config-Files-Prod/NGINX Redirect/
        dest: /etc/nginx
        force: yes
        directory_mode: yes

But I end up with the following error:

Could not find or access './Config-Files-Prod/NGINX Redirect/'\nSearched in:\n\t<http://server.com/job/Ansible-AS/ws/Play-Books-Prod/files/./Config-Files-Prod/NGINX
Apr 4, 2019 in Ansible by Asha
3,489 views

1 answer to this question.

0 votes
Hey, @Asha seems like you've added a wrong path to the source. Check if you've added the correct path. Let me know.
answered Apr 4, 2019 by Akhil

Yeah! I was using the wrong path. I changed the path to 

../Config-Files-Prod/NGINX Redirect/

And it worked!! Thank you:)

Related Questions In Ansible

0 votes
1 answer
0 votes
1 answer

How to create a key pair on AWS using Ansible-Playbook?

Hi@akhtar, You can find the ec2_key module in ...READ MORE

answered Aug 12, 2020 in Ansible by MD
• 95,460 points
1,451 views
0 votes
1 answer

How to create a simple S3 bucket on Ceph Rados Gateway using Ansible Playbook?

Hi@MD, Ansible has one module that can create ...READ MORE

answered Dec 4, 2020 in Ansible by akhtar
• 38,260 points
1,315 views
+1 vote
3 answers
0 votes
1 answer

Not able to connect remote host via jenkins to run ansible playbook

set "host_key_checking = False" in /etc/ansible/ansible.cfg READ MORE

answered Dec 2, 2019 in Jenkins by pavan

reshown Dec 2, 2019 by Vardhan 10,215 views
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
4,036 views
0 votes
1 answer

Error when executing ansible playbook on Azure

Hey @Ganga, As the error message says, ...READ MORE

answered Jan 29, 2019 in Ansible by Kavya
1,033 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP