When ansible logs in to the remote systems, which shell does it uses ?
I am asking this because of this question here,
https://askubuntu.com/questions/937354/track-logins-made-via-non-interactive-shells?noredirect=1#comment1486323_937354
Please tell me how can I do what is asked in this question ?
Question 2 - If I have 10 tasks in a playbook, then logs in 10 times to remote host OR uses a single connection ?
1) It is configurable, but by default it should be /bin/sh
2) Logs in 10 times, which does not mean it connects 10 times as the
connection itself can be persistent even if the login is not
Thank you.
ANother Scenario,
If I am running 10 tasks on 2 hosts,
It will do first task on host 1 and then on host 2
then second task on host 1 and then on host 2,
…
.
.
So, here also the connection persists to both the hosts?
OR
does it firstly connect to host 1, runs task 1 and then disconnects AND then connects to host 2, runs task 1 and then disconnects ?
Depends ... but if using defaults (ssh with control persist enabled)
you should have the persistent connection still at task2 for both
hosts ... unless the time between tasks is greater than the connection
timeout (60s) ... which should only happen if you are processing a LOT
of hosts at a time. In those cases you normally want to restrict the
play targets or use serial batches.
http://docs.ansible.com/ansible/latest/intro_configuration.html#timeout
This says that the default timeout is 10 seconds.
So, it means after every 10 seconds it makes a new connection ?
What if some task is running and the connection times out ? What will happen then ?
I am sorry If I am asking annoying questions. Please don’t mind.
wrong timeout, that is 'timeout while ssh is attempting to connect
before we consider the attempt failed' not timeout of 'idle
controlpersist'