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, 2019 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, 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,220 points
0 votes
1 answer
+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 5,075 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 26, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
0 votes
1 answer

Error when executing ansible playbook on Azure

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

answered Jan 28, 2019 in Ansible by Kavya