# Documentation: action: module   vs module:

**URL:** <https://forum.ansible.com/t/documentation-action-module-vs-module/13043>\
**Category:** Ansible Project\
**Created:** [June 29, 2013, 10:26pm UTC](https://forum.ansible.com/t/documentation-action-module-vs-module/13043 "2013-06-29T22:26:56Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jpmens1](https://avatars.discourse-cdn.com/v4/letter/j/e9c0ed/32.png) [@jpmens1](https://forum.ansible.com/u/jpmens1)\
**Post date:** [June 29, 2013, 10:26pm UTC](https://forum.ansible.com/t/documentation-action-module-vs-module/13043/1 "2013-06-29T22:26:56Z")

</div>

Hello,

Dag and I pulled straws on who'd write this message, and I lost. 😉

Ansible's original playbook syntax for invoking a module was

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- action: modulename ...

This was later augmented to allow omission of the "action" keyword.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- modulename ...

I forget the history of why it was decided to use the second syntax form  
in the documentation, but that is the way it currently is (I recently  
submitted a huge patch which cleaned that up).

Discussion today brought this topic up again, and a number of people  
(myself included) feel that adding the "action:" keyword makes a) more  
sense and b) looks better, particularly when mixed with things like  
local\_action where the latter may \*not\* be omitted. Compare

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- action: copy src=  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- action: shell ...  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;register: var  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- local\_action: get\_url ...

and

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- copy: src=  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- shell: ...  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;register: var  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- local\_action: get\_url

(In the latter example, it's difficult to see that 'register' is not a  
module ...)

Can we, once in for all, settle this? We are not proposing to disallow  
the syntax within the playbook (which would break backwards  
compatibility!), but simply trying to establish a "standard" by which we  
document things, both in the official Ansible documentation as well as  
in whatever other things we write about Ansible.

Whichever method we settle on, I'll gladly go through all the modules  
again (\*groans\*) and fix the EXAMPLES string.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-JP

---

<div class="post-metadata">

**Author:** ![Stephen\_Fromm](https://avatars.discourse-cdn.com/v4/letter/s/bbce88/32.png) [@Stephen\_Fromm](https://forum.ansible.com/u/Stephen_Fromm)\
**Post date:** [June 29, 2013, 10:44pm UTC](https://forum.ansible.com/t/documentation-action-module-vs-module/13043/2 "2013-06-29T22:44:54Z")

</div>

My $0.02: I prefer the ‘action: ’ style syntax just because it is more explicit about what is being done, especially when you have other parts to a task such as register, with\_items, when and so on.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [June 29, 2013, 11:46pm UTC](https://forum.ansible.com/t/documentation-action-module-vs-module/13043/3 "2013-06-29T23:46:41Z")

</div>

yeah I know this was controversial before.

Lots of folks also prefer the shorthand of not having to type the extra “action:” line.

When I wrote Ansible, one of things I strove for was to make it maximally readable, which is why when someone came up with the idea to say “hey, why do you have to type action all the time”, I said, sure, that’s a great idea, and thus we have standardized on “module: foo”.

Obviously local action requires a bit of a difference, but it’s also the same as:

module: foo  
delegate\_to: localhost

Given I already remember this discussion from several months ago when we moved to standardize on “module: foo”, I’m not really wanting to have it again 🙂

We have been standardizing on “module: foo” in Ansible-examples.

---

<div class="post-metadata">

**Author:** ![David\_Golden](https://avatars.discourse-cdn.com/v4/letter/d/d2c977/32.png) [@David\_Golden](https://forum.ansible.com/u/David_Golden)\
**Post date:** [June 30, 2013, 12:45am UTC](https://forum.ansible.com/t/documentation-action-module-vs-module/13043/4 "2013-06-30T00:45:50Z")

</div>

I also sometimes tend to favor "args:" for more readability and think  
"action:" is more readable in that case, too.

David

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [June 30, 2013, 2:58pm UTC](https://forum.ansible.com/t/documentation-action-module-vs-module/13043/5 "2013-06-30T14:58:24Z")

</div>

FYI: We are not taking votes here.
