i have ansible playbook and i want to look at specified directory (with ls command). the directory is in the root, i check with the pwd command :
/root/git/ansible/data/example
and the ansible the task looks like this :
name: open directory
become: yes
become_user: root
command: chdir=/data/example ls
after i execute the playbook i get this error :
fatal: [localhost]: FAILED! => {"changed": false, "msg": "Unable to change directory before execution: [Errno 2] No such file or directory: '/data/example'"}
while the directory actually does exist. i also tried this :
name: open directory
become: yes
become_user: root
shell:
cmd: ls
chdir: /data/example
and got the same error. can anyone help?