Questions about Ansible connection to remote hosts
Can't answer 1 (I always thought it just uses the default /bin/sh unless specified otherwise?).


It will make the connection more than 10 times.  A single task will typically have an SCP or SFTP connection to copy the taskfile that'll get remotely executed, then another connection to trigger the script.  You can monitor this happening by running your playbook with -vvv, such as:

ansible-playbook deploy_app.yml -u maplebird -vvv


3rd-level verbosity shows all connections to client.
By default, Ansible will execute tasks concurrently on all hosts up to the max configured number of forks.  So, it'll run task 1 on both hosts, then it'll run task 2 on both hosts, etc.  Forks are defined in ansible.cfg, and default to 5.  Change this variable to a higher number or comment it out:

forks = 5


Optionally, you can also do a rolling batch when running playbooks by specifying the serial option in the playbook.  This will only concurrently execute tasks for however many hosts you've defined.

Say you're running a playbook against 5 hosts, and have the serial option set.  With serial = 1, it will run the full playbook 1 host at a time.  With serial = 2, it will run hosts 1 &amp; 2, then hosts 2 &amp; 3, then host 5.  Example:

name: deploy to all webservers
hosts: webservers
serial: 2
roles:
   - deploy_application



More reading:

Serial (rolling) playbook runs:


http://docs.ansible.com/ansible/latest/playbooks_delegation.html#rolling-update-batch-size


Forks:


http://docs.ansible.com/ansible/latest/intro_configuration.html#forks


Hope this helps.