# Ansible Script Execution directory change from root path to other path

**URL:** <https://forum.ansible.com/t/ansible-script-execution-directory-change-from-root-path-to-other-path/28664>\
**Category:** Ansible Project\
**Created:** [September 27, 2018, 3:11pm UTC](https://forum.ansible.com/t/ansible-script-execution-directory-change-from-root-path-to-other-path/28664 "2018-09-27T15:11:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![venkatesh\_vanigalla](https://avatars.discourse-cdn.com/v4/letter/v/7ea924/32.png) [@venkatesh\_vanigalla](https://forum.ansible.com/u/venkatesh_vanigalla)\
**Post date:** [September 27, 2018, 3:11pm UTC](https://forum.ansible.com/t/ansible-script-execution-directory-change-from-root-path-to-other-path/28664/1 "2018-09-27T15:11:47Z")

</div>

How to change ansible script execution directory from /root to other fodler?

---

<div class="post-metadata">

**Author:** ![John\_Peters](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/john_peters/32/9637_2.png) [@John\_Peters](https://forum.ansible.com/u/John_Peters)\
**Post date:** [September 27, 2018, 3:16pm UTC](https://forum.ansible.com/t/ansible-script-execution-directory-change-from-root-path-to-other-path/28664/2 "2018-09-27T15:16:08Z")

</div>

```auto
- 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](https://docs.ansible.com/ansible/2.5/modules/shell_module.html)
