# Do I need to use wait\_for and/or handler to install software from a playbook?

**URL:** <https://forum.ansible.com/t/do-i-need-to-use-wait-for-and-or-handler-to-install-software-from-a-playbook/29950>\
**Category:** Ansible Project\
**Tags:** ansible-project\
**Created:** [March 22, 2019, 5:47am UTC](https://forum.ansible.com/t/do-i-need-to-use-wait-for-and-or-handler-to-install-software-from-a-playbook/29950 "2019-03-22T05:47:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [March 22, 2019, 5:47am UTC](https://forum.ansible.com/t/do-i-need-to-use-wait-for-and-or-handler-to-install-software-from-a-playbook/29950/1 "2019-03-22T05:47:13Z")

</div>

> Hello,  
> I understand that tasks in a playbook run top down but I don't know if they  
> wait for each other.

They do.

> I have a question about how you control multiple  
> package installs in a way so that subsequent tasks (that install software)  
> will not run until the previous software installation is finished.

Default in Ansible the first task is run on all hosts, when that task in finished on all host. Ansible will start to run the second task on all host and so on.

> I’m  
> using a combination of yum module and command module to do the software  
> installs:

Please don't do that, just use the yum module.

> tasks:
> 
> &nbsp;&nbsp;&nbsp;- name: First run yum update -y with yum module
> 
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;yum:
> 
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;name: "\*"
> 
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;state: latest
> 
> &nbsp;&nbsp;&nbsp;- name: Only After yum update is done install python3 with a specific command
> 
> &nbsp;&nbsp;&nbsp;command: sudo yum -y install python3 python3-pip

I highly recommend using yum instead

&nbsp;&nbsp;- name: Install python3 and pip3  
&nbsp;&nbsp;&nbsp;&nbsp;yum:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- python3  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- python3-pip

> &nbsp;&nbsp;&nbsp;- name: Only After python is installed install the latest version of  
> Apache with yum module
> 
> &nbsp;&nbsp;&nbsp;yum:
> 
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;name: httpd
> 
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;state: latest
> 
> Will this work as is or do I need to add “wait\_for” or use a "handler" to  
> make sure that one install is completed before the next one is started?

No wait is required, since Ansible run the task in order and finishes a task on all server before it goes to the next task.
