Using Ansible Conditionals Exception - Could not find or access file

Hello @KodeKloud @Inderpreet @player001, and anyone else that can help

When running Using Ansible Conditionals task, I encountered the following errors

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: If you are using a module and expect the file to exist on the remote, see the remote_src option
fatal: [stapp01]: FAILED! => {"changed": false, "msg": "Could not find or access '/usr/src/finance/blog.text' on the Ansible Controller.\nIf you are using a module and expect the file to exist on the remote, see the remote_src option"}

Please see screenshot:

Proof that the files exist on Controller

And here is the copy section of my playbook.

copy:
  src: /usr/src/finance/blog.text
  dest: /opt/finance/blog.txt
  owner: '{{ ansible_user }}'
  group: '{{ ansible_user }}'
  mode: '0655'
when: ansible_nodename == "stapp01"

I have tried using become_user: root in playbook as well as sudo su and then running ansible-playbook -i inventory playbook.yml none of which worked.

I’m not sure what I am missing. Could someone please point me to what I’m getting wrong?

Thank you

Can you please look into the file name. It’s blog.txt not blog.text

1 Like

:man_facepalming: :man_facepalming: :man_facepalming:

Thank you…

Don’t worry sometimes it happens :slight_smile: prepare for the next run.