Junior — Middle
Can you explain what the term 'Forks' means in the context of Ansible and how it is used?
sobes.tech AI
Answer from AI
In Ansible, the term "Forks" refers to the number of parallel processes that Ansible launches to execute tasks simultaneously on different hosts. This allows for faster playbook execution, as commands are executed not sequentially, but in parallel.
By default, the value of forks is 5, but it can be changed in the ansible.cfg configuration file or via a command-line parameter. For example, if you have 20 servers and forks=10, Ansible will work with 10 servers at a time, then with the remaining ones.
Example configuration in ansible.cfg:
[defaults]
forks = 10
Increasing forks is useful for speeding up deployment, but setting it too high can lead to load on the control machine or network.