Bootstrap FreeKB - Ansible - Limit the number of workers using Throttle (Parallelism)
Ansible - Limit the number of workers using Throttle (Parallelism)

Updated:   |  Ansible articles

throttle set's a limit on the number of workers that are used when performing a task. 

Let's say you have a task that requires a lot of CPU or memory. In this example, let's say the foo.sh script will require a lot of CPU or memory. The throttle parameter can be used to limit the number of workers (1 worker in this example).

---
- hosts: all
  tasks:
    - name: run foo.sh
      script: /path/to/foo.sh
      throttle: 1
...

 

Be aware that forks (set a limit on the number of managed nodes that will processes a playbook simultaneously) and serial (set a limit on the number or percentage of managed nodes that will process a playbook) will take precedence over throttle. For example, if you have set a limit of 5 forks, and throttle is set to 10, forks will take precedence at 5.




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter e895d6 in the box below so that we can be sure you are a human.