On 21.03.2019 01:41, [email protected] wrote:
>
>
> 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:
>
> - name: First run yum update -y with yum module
>
> yum:
>
> name: "*"
>
> state: latest
>
> - name: Only After yum update is done install python3 with a specific
> command
>
> command: sudo yum -y install python3 python3-pip
I highly recommend using yum instead
- name: Install python3 and pip3
yum:
- python3
- python3-pip
>
> - name: Only After python is installed install the latest version of
> Apache with yum module
>
> yum:
>
> name: httpd
>
> 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.
--
Kai Stian Olstad
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/50f397a7-4eda-82aa-f99a-e8242b5f24a2%40olstad.com.
For more options, visit https://groups.google.com/d/optout.