# Question - Which shell ansible uses ?

**URL:** <https://forum.ansible.com/t/question-which-shell-ansible-uses/25029>\
**Category:** Ansible Project\
**Created:** [July 20, 2017, 12:49pm UTC](https://forum.ansible.com/t/question-which-shell-ansible-uses/25029 "2017-07-20T12:49:26Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Luvpreet\_Singh](https://avatars.discourse-cdn.com/v4/letter/l/a5b964/32.png) [@Luvpreet\_Singh](https://forum.ansible.com/u/Luvpreet_Singh)\
**Post date:** [July 20, 2017, 12:49pm UTC](https://forum.ansible.com/t/question-which-shell-ansible-uses/25029/1 "2017-07-20T12:49:26Z")

</div>

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](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 ?

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [July 20, 2017, 12:51pm UTC](https://forum.ansible.com/t/question-which-shell-ansible-uses/25029/2 "2017-07-20T12:51:45Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Luvpreet\_Singh](https://avatars.discourse-cdn.com/v4/letter/l/a5b964/32.png) [@Luvpreet\_Singh](https://forum.ansible.com/u/Luvpreet_Singh)\
**Post date:** [July 20, 2017, 12:59pm UTC](https://forum.ansible.com/t/question-which-shell-ansible-uses/25029/3 "2017-07-20T12:59:17Z")

</div>

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 ?

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [July 20, 2017, 1:58pm UTC](https://forum.ansible.com/t/question-which-shell-ansible-uses/25029/4 "2017-07-20T13:58:09Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Luvpreet\_Singh](https://avatars.discourse-cdn.com/v4/letter/l/a5b964/32.png) [@Luvpreet\_Singh](https://forum.ansible.com/u/Luvpreet_Singh)\
**Post date:** [July 20, 2017, 2:37pm UTC](https://forum.ansible.com/t/question-which-shell-ansible-uses/25029/5 "2017-07-20T14:37:22Z")

</div>

[http://docs.ansible.com/ansible/latest/intro\_configuration.html#timeout](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.

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [July 20, 2017, 11:24pm UTC](https://forum.ansible.com/t/question-which-shell-ansible-uses/25029/6 "2017-07-20T23:24:24Z")

</div>

wrong timeout, that is 'timeout while ssh is attempting to connect  
before we consider the attempt failed' not timeout of 'idle  
controlpersist'
