Running a playbook using Ansible on Jenkins

0 votes

I am trying to run an Ansible playbook via Jenkins

    - hosts: all
    - name: Print message
      debug: msg="Hello number 2 from Ansible!!"
    - name: ping all hosts
    - debug: var=ansible_all_ipv4_addresses
    - name: Update the repository cache and update package "nginx" to latest version using default release squeeze-backport
        name: nginx
        state: latest
        update_cache: yes
    - name: Copy config files for nginx
        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<
Apr 4 in Ansible by Asha

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 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
3 answers
0 votes
1 answer

Running ansible command on a single server when it is deployed to multiple servers

You can try the run_once attribute: Example from ...READ MORE

answered Jun 13, 2018 in Ansible by DareDev
• 6,810 points
0 votes
1 answer

Permission denied when running ansible playbook through jenkins

Jenkins uses it's own user to execute ...READ MORE

answered Jun 25, 2018 in Ansible by DareDev
• 6,810 points
0 votes
0 answers

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

Not able to connect remote host via ...READ MORE

Apr 2 in Jenkins by Nishant
• 160 points

recategorized Apr 2 by Nishant 1,187 views
+13 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 26, 2018 in DevOps & Agile by DragonLord999
• 8,380 points
0 votes
1 answer

Error when executing ansible playbook on Azure

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

answered Jan 28 in Ansible by Kavya