Parallel execution

36 views
Skip to first unread message

Tom De Blende

unread,
Jun 20, 2016, 2:06:49 AM6/20/16
to Ansible Project
Hi all,

From the docs, I read that by default, tasks within a playbook are executed in parallel. This behavior can be changed by using the serial directive.

Now I have simple playbook to update Red Hat servers. It looks like this:

---
# file: RedHat.yml

- name: update all packages
  yum:
    name: '*'
    state: latest
  notify:
    - reboot server
    - wait for server to restart
  tags:
    - update_all


The handlers look like this:

---
# file reboot.yml

- name: reboot server
  shell: shutdown -r now "Reboot triggered by Ansible."
  async: 0
  poll: 0
  ignore_errors: true

- name: wait for server to restart
  local_action: wait_for host="{{ec2_private_ip_address}}" port=22 delay=10 timeout=600 search_regex=OpenSSH
  become: false


This all works fine. However, from the sshd and yum logs, it looks like the update process was not executed in parallel on all hosts. Why would this be?

Kind regards,
Tom

Brian Coca

unread,
Jun 20, 2016, 9:18:51 AM6/20/16
to ansible...@googlegroups.com
The parallelization is limited by number of forks (5 by default) you can change this on the command line with -f.

Be mindful that each fork consumes more resources on your controller machine, so you are mostly limited by available resources there.

----------
Brian Coca

Tom De Blende

unread,
Jun 20, 2016, 9:23:10 AM6/20/16
to ansible...@googlegroups.com
Thanks Brian, that is indeed the case.

--
You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/LKgzv9o7V7M/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CACVha7eOEdS%3DVRZQGPsLo4frbZ9aZDNwYvBOUo2oByMP-Dubzg%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages