# Command task with args

**URL:** <https://forum.ansible.com/t/command-task-with-args/16532>\
**Category:** Ansible Developer\
**Created:** [October 16, 2014, 1:43pm UTC](https://forum.ansible.com/t/command-task-with-args/16532 "2014-10-16T13:43:09Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Graham\_Hay](https://avatars.discourse-cdn.com/v4/letter/g/59ef9b/32.png) [@Graham\_Hay](https://forum.ansible.com/u/Graham_Hay)\
**Post date:** [October 16, 2014, 1:43pm UTC](https://forum.ansible.com/t/command-task-with-args/16532/1 "2014-10-16T13:43:09Z")

</div>

I have a task like this:

- name: Run migrations  
sudo: yes  
sudo\_user: postgres  
command: “goose -env foo up”  
args:  
chdir: “{{ migrations\_dir }}”

when I updated to the head of ansible/devel (1d04e4b3d27b0ae16619eda4136a939fe6f3299c) it returns an error (from the executed command, not ansible), as if the working dir is being ignored. If I change it to this:

- name: Run migrations  
sudo: yes  
sudo\_user: postgres  
command: goose -env foo up chdir=“{{ migrations\_dir }}”

it works as expected. Is the first version still valid syntax?

Core modules is at: 8614ef8d6f90a2d292721d0f6fab328aa16d7589, and Extras is at: a0df36c6ab257281cbaae00b8a4590200802f571.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [October 20, 2014, 9:35pm UTC](https://forum.ansible.com/t/command-task-with-args/16532/2 "2014-10-20T21:35:28Z")

</div>

args should still work on this version, but may be an invalid keyword in the future.

I can see why you would want to pass args since it’s unclear how to send the rest of the parameter as a hash though.

Can you file a ticket?

Thanks!

---

<div class="post-metadata">

**Author:** ![Graham\_Hay](https://avatars.discourse-cdn.com/v4/letter/g/59ef9b/32.png) [@Graham\_Hay](https://forum.ansible.com/u/Graham_Hay)\
**Post date:** [October 21, 2014, 9:01am UTC](https://forum.ansible.com/t/command-task-with-args/16532/3 "2014-10-21T09:01:19Z")

</div>

On the main repo, or modules-core? I have no idea where the code for that would be.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [October 22, 2014, 3:42am UTC](https://forum.ansible.com/t/command-task-with-args/16532/4 "2014-10-22T03:42:15Z")

</div>

Yeah it’s not obvious - Main repo. This should be a language issue.

Thanks!

---

<div class="post-metadata">

**Author:** ![Graham\_Hay](https://avatars.discourse-cdn.com/v4/letter/g/59ef9b/32.png) [@Graham\_Hay](https://forum.ansible.com/u/Graham_Hay)\
**Post date:** [October 22, 2014, 7:59am UTC](https://forum.ansible.com/t/command-task-with-args/16532/5 "2014-10-22T07:59:29Z")

</div>

[Done](https://github.com/ansible/ansible/issues/9400).
