Is there a way to set the number of forks from within a playbook?
The default is fine for most of our playbooks, but one of them benefits from a higher number. I don't want to rely on people remembering to set -f20 for this particular playbook (that's why we use ansible, humans are unreliable!).
Now I have another case where we install a piece of software that registers against a manager, but, that manager server can only accept one registration at a time... Being able to force "-f 1" (forks = 1 ???) would solve this issue (and the one above!).
Because we don't want to rely on human memory (remembering to use -f1 when running the playbook, or running the playbook once against each host with -l), we ended up creating one group per host - clunky!
forks just uses multiprocessing.py straight, so it will create 5 if --forks=5.
Given sufficient memory, --forks 50 is not unheard of, but can get a
little RAM hungry at those levels.
Generally folks are almost always setting the serial value at those
levels (rolling update mode) and it does not make sense to have forks
exceed the serial count.
There really isn't a reason we can't auto-minimize the fork count when
it is not needed.
Being able to specify a number of forks in a play would be really helpful.
My use case is that in a playbook I have a play to ‘git pull’ and some other plays (compile the code, for example).
The thing is that the git server I use has some restrictions on the number of simultaneous connections.
So I’d like to run the first play with a certain number of forks and the rest as much parallel as possible.
The workaround for me would be to use ‘serial’, but it runs slowly as it waits all the hosts in a series and only then runs the next one.