# what is mean by play and what's the diffrence plays vs tasks, example please?

**URL:** <https://forum.ansible.com/t/what-is-mean-by-play-and-whats-the-diffrence-plays-vs-tasks-example-please/26328>\
**Category:** Ansible Project\
**Created:** [December 19, 2017, 2:42am UTC](https://forum.ansible.com/t/what-is-mean-by-play-and-whats-the-diffrence-plays-vs-tasks-example-please/26328 "2017-12-19T02:42:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chandramohan\_Reddy](https://avatars.discourse-cdn.com/v4/letter/c/ed655f/32.png) [@Chandramohan\_Reddy](https://forum.ansible.com/u/Chandramohan_Reddy)\
**Post date:** [December 19, 2017, 2:42am UTC](https://forum.ansible.com/t/what-is-mean-by-play-and-whats-the-diffrence-plays-vs-tasks-example-please/26328/1 "2017-12-19T02:42:49Z")

</div>

Hi All,

Can you please explain me what is play and play vs tasks .

Could you give any example for play.

Thanks & Regards  
ChandraMohan

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [December 19, 2017, 8:54pm UTC](https://forum.ansible.com/t/what-is-mean-by-play-and-whats-the-diffrence-plays-vs-tasks-example-please/26328/2 "2017-12-19T20:54:12Z")

</div>

tasks are actions to be performed, a play is a mapping between a list  
of hosts and list of tasks.

Normally you can recognize a play as it is the only thing that has a  
`hosts:` keyword, tasks always belong inside a play, normally under  
the tasks: keyword.

- name: this is a play  
&nbsp;&nbsp;hosts: all  
&nbsp;&nbsp;tasks:  
&nbsp;&nbsp;&nbsp;&nbsp;- name: this is a task  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;debug: msg=this is a task

Tasks can be put in more places other than the tasks keyword, but they  
always need to be inside a play to be executed. i.e they can be in a  
role, but the role must be in a play.
