0

Ansible Version=2.7 I am trying to copy files from the local machines to a remote machine using an ansible playbook. The playbook is simple:

- name: Copy file to remote
  become: yes
  copy:
          src: /etc/directory/file.txt
          dest: /etc/directory
          mode: '0664'

This returns an error "ansible.errors.AnsibleFileNotFound: Could not find or access /etc/directory/file.txt" "Could not find or access '/etc/directory/file.txt' on the Ansible Controller.\nIf you are using a module and expect the file to exist on the remote, see the remote_src option"

So i tried changing this files permission to 777 and also changing the files owner and group but that didn't help. Then i copied this file out of the /etc directory into the home directory and the copy was successful. Why is this happening? I am using become: yes on the whole playbook to elevate my privilges as well so this error is confusing me.

manhasnoname
  • 173
  • 2
  • 6
  • 12

0 Answers0