How to change ansible script execution directory from /root to other fodler?
- name: Change the working directory to somedir/ before executing the command.
shell: somescript.sh >> somelog.txt
args:
chdir: somedir/
Does this help? Stolen from: https://docs.ansible.com/ansible/2.5/modules/shell_module.html