0
votes

I want to copy files from my ansible controller to a remote machine. When i run the playbook with -vvv i get the error "Source /path/to/file/file.txt not found". I have become: yes in my playbook as well as for this specific task. I also tried using the become_user: root but that did not work. The directory I am trying to access is owned by nagios so I also tried become_user: nagios but I got the same error. The permissions on the directory are "drwx------" but since I am using become: yes this shouldn't be an issue right? Here's a part of my playbook:

- name: Send file to client
  become: true
  become_user: root
  src: /path/to/file.txt
  dest: /remote/path/
  owner: nagios
  group: nagios
  mode: '0644'
  remote_src: yes
1

1 Answers

2
votes

If you "want to copy files from ansible controller" disable remote_src. This is the default hence you can delete this attribute as well.

 remote_src: false

Notes

  • become: yes and become_user: root has no effect at the originating/master machine. This escalates privilege at the remote host.

  • The user who is running ansible-playbook at the master machine must be able to access the file.