# Multiple modules in a same task

**URL:** <https://forum.ansible.com/t/multiple-modules-in-a-same-task/24279>\
**Category:** Ansible Project\
**Created:** [April 21, 2017, 8:21am UTC](https://forum.ansible.com/t/multiple-modules-in-a-same-task/24279 "2017-04-21T08:21:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![groupfiles14](https://avatars.discourse-cdn.com/v4/letter/g/54ee81/32.png) [@groupfiles14](https://forum.ansible.com/u/groupfiles14)\
**Post date:** [April 21, 2017, 8:21am UTC](https://forum.ansible.com/t/multiple-modules-in-a-same-task/24279/1 "2017-04-21T08:21:55Z")

</div>

Is it possible to have multiple modules in same task? for example : if i want to copy a file and extract it cant i use copy and unzip in same task? should i create separate tasks for each module?

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [April 21, 2017, 7:14pm UTC](https://forum.ansible.com/t/multiple-modules-in-a-same-task/24279/2 "2017-04-21T19:14:19Z")

</div>

Each action is a task, modules provide actions. It would be the same  
as saying 'can i have multiple tasks per task'.

---

<div class="post-metadata">

**Author:** ![j.r.hawkesworth](https://avatars.discourse-cdn.com/v4/letter/j/a3d4f5/32.png) [@j.r.hawkesworth](https://forum.ansible.com/u/j.r.hawkesworth)\
**Post date:** [April 21, 2017, 7:23pm UTC](https://forum.ansible.com/t/multiple-modules-in-a-same-task/24279/3 "2017-04-21T19:23:09Z")

</div>

Yes, each module usage is a separate task. You can use roles to group together tasks so that you can reuse them. Have a look on ansible galaxy - there are lots of roles there to install and configure things.

Once you have tried using and making roles, it would be worth looking at blocks as I think they can be used to group together related tasks.

Jon
