Question - Which shell ansible uses ?

36 views
Skip to first unread message

Luvpreet Singh

unread,
Jul 20, 2017, 8:49:26 AM7/20/17
to Ansible Project
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 ?

Brian Coca

unread,
Jul 20, 2017, 8:51:55 AM7/20/17
to Ansible Project
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


--
----------
Brian Coca

Luvpreet Singh

unread,
Jul 20, 2017, 8:59:17 AM7/20/17
to Ansible Project
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 ?

Brian Coca

unread,
Jul 20, 2017, 9:58:23 AM7/20/17
to Ansible Project
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.


--
----------
Brian Coca

Luvpreet Singh

unread,
Jul 20, 2017, 10:37:22 AM7/20/17
to Ansible Project
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.

Brian Coca

unread,
Jul 20, 2017, 7:24:37 PM7/20/17
to Ansible Project
wrong timeout, that is 'timeout while ssh is attempting to connect
before we consider the attempt failed' not timeout of 'idle
controlpersist'




--
----------
Brian Coca
Reply all
Reply to author
Forward
0 new messages