# Roles syntax vs. actions or includes

**URL:** <https://forum.ansible.com/t/roles-syntax-vs-actions-or-includes/13004>\
**Category:** Ansible Project\
**Created:** [June 21, 2013, 2:25pm UTC](https://forum.ansible.com/t/roles-syntax-vs-actions-or-includes/13004 "2013-06-21T14:25:55Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![martin\_f\_krafft](https://avatars.discourse-cdn.com/v4/letter/m/8797f3/32.png) [@martin\_f\_krafft](https://forum.ansible.com/u/martin_f_krafft)\
**Post date:** [June 21, 2013, 2:25pm UTC](https://forum.ansible.com/t/roles-syntax-vs-actions-or-includes/13004/1 "2013-06-21T14:25:55Z")

</div>

Hello,

is there a reason that a role needs to be parametrised like this:

---

<div class="post-metadata">

**Author:** ![martin\_f\_krafft](https://avatars.discourse-cdn.com/v4/letter/m/8797f3/32.png) [@martin\_f\_krafft](https://forum.ansible.com/u/martin_f_krafft)\
**Post date:** [June 21, 2013, 5:59pm UTC](https://forum.ansible.com/t/roles-syntax-vs-actions-or-includes/13004/2 "2013-06-21T17:59:10Z")

</div>

also sprach martin f krafft \<madduck@madduck.net\> [2013.06.21.1625 +0200]:

> Wouldn't it be more consistent (and readable) if roles could also be  
> parametrised with var=val pairs? I'd be happy to submit the  
> corresponding PR… but I wanted to make sure that the time is not  
> lost because e.g. there's a good reason for the status quo that I am  
> not seeing.

[https://github.com/ansible/ansible/pull/3311](https://github.com/ansible/ansible/pull/3311)

---

<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 22, 2013, 5:27pm UTC](https://forum.ansible.com/t/roles-syntax-vs-actions-or-includes/13004/3 "2013-06-22T17:27:26Z")

</div>

I actually like the hash form more and it’s likely we’re going to move to standardize to allow that for includes as well and would be moving documentation to follow that.

---

<div class="post-metadata">

**Author:** ![martin\_f\_krafft](https://avatars.discourse-cdn.com/v4/letter/m/8797f3/32.png) [@martin\_f\_krafft](https://forum.ansible.com/u/martin_f_krafft)\
**Post date:** [June 22, 2013, 5:49pm UTC](https://forum.ansible.com/t/roles-syntax-vs-actions-or-includes/13004/4 "2013-06-22T17:49:36Z")

</div>

also sprach Michael DeHaan \<michael@ansibleworks.com\> [2013.06.22.1927 +0200]:

> I actually like the hash form more and it's likely we're going to move to  
> standardize to allow that for includes as well and would be moving  
> documentation to follow that.

Compared to  
[https://groups.google.com/d/msg/ansible-project/W-pi3b1a3jI/qQrQNl9uU90J](https://groups.google.com/d/msg/ansible-project/W-pi3b1a3jI/qQrQNl9uU90J),  
what made you change your mind?

Why not support both? I prefer not to have to use delimiters like {},  
which expose too much of the underlying implementation, IMHO.

---

<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 22, 2013, 6:14pm UTC](https://forum.ansible.com/t/roles-syntax-vs-actions-or-includes/13004/5 "2013-06-22T18:14:29Z")

</div>

My choice.

it’s a data format, it has nothing to do with implementation.

---

<div class="post-metadata">

**Author:** ![martin\_f\_krafft](https://avatars.discourse-cdn.com/v4/letter/m/8797f3/32.png) [@martin\_f\_krafft](https://forum.ansible.com/u/martin_f_krafft)\
**Post date:** [June 23, 2013, 8:20am UTC](https://forum.ansible.com/t/roles-syntax-vs-actions-or-includes/13004/6 "2013-06-23T08:20:41Z")

</div>

also sprach Michael DeHaan \<michael@ansibleworks.com\> [2013.06.22.2014 +0200]:

> My choice. it's a data format, it has nothing to do with  
> implementation.

You are right, of course, and it's moreover true that hashes are  
more consistent with the overall configuration paradigm — YAML.

Will you also deprecate the current syntax for modules (actions),  
for consistency? Or will users have to remember somehow that actions  
are to be handled differently than includes and roles?

Right now, an action takes parameters and can sit alongside Ansible  
keywords, e.g.

---

<div class="post-metadata">

**Author:** ![GW1](https://avatars.discourse-cdn.com/v4/letter/g/c89c15/32.png) [@GW1](https://forum.ansible.com/u/GW1)\
**Post date:** [June 23, 2013, 11:32am UTC](https://forum.ansible.com/t/roles-syntax-vs-actions-or-includes/13004/7 "2013-06-23T11:32:09Z")

</div>

Hi,

The “role:” syntax proposal could be implemented similarly as “include:” where you have separation between module and Ansible keywords. Es far as I remember it is possible to do:

---

<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 23, 2013, 1:33pm UTC](https://forum.ansible.com/t/roles-syntax-vs-actions-or-includes/13004/8 "2013-06-23T13:33:07Z")

</div>

There are no plans for syntax deprecation.

Also, roles don’t make sense architecturally as actions.

Sorry.

---

<div class="post-metadata">

**Author:** ![martin\_f\_krafft](https://avatars.discourse-cdn.com/v4/letter/m/8797f3/32.png) [@martin\_f\_krafft](https://forum.ansible.com/u/martin_f_krafft)\
**Post date:** [June 23, 2013, 3:01pm UTC](https://forum.ansible.com/t/roles-syntax-vs-actions-or-includes/13004/9 "2013-06-23T15:01:28Z")

</div>

also sprach Michael DeHaan \<michael@ansibleworks.com\> [2013.06.23.1533 +0200]:

> Also, roles don't make sense architecturally as actions.

Weren't you the one that said that roles are similar to Puppet  
defines?

---

<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 23, 2013, 4:34pm UTC](https://forum.ansible.com/t/roles-syntax-vs-actions-or-includes/13004/10 "2013-06-23T16:34:17Z")

</div>

By saying roles aren't just actions, I mean they cannot be interlaced with  
actions in the task section, and they go under the "roles" header.

That's all.
