# Modify ssh connection arguments that ansible uses.

**URL:** <https://forum.ansible.com/t/modify-ssh-connection-arguments-that-ansible-uses/33776>\
**Category:** Ansible Project\
**Created:** [September 9, 2020, 9:34am UTC](https://forum.ansible.com/t/modify-ssh-connection-arguments-that-ansible-uses/33776 "2020-09-09T09:34:03Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Easy\_King](https://avatars.discourse-cdn.com/v4/letter/e/c2a13f/32.png) [@Easy\_King](https://forum.ansible.com/u/Easy_King)\
**Post date:** [September 9, 2020, 9:34am UTC](https://forum.ansible.com/t/modify-ssh-connection-arguments-that-ansible-uses/33776/1 "2020-09-09T09:34:03Z")

</div>

The below ssh connection by ansible fails to connect to remote hosts

ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o ‘IdentityFile=“/app/ssh\_keys/id\_rsa”’ -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ‘User=“root”’ -o ConnectTimeout=10 -o StrictHostKeyChecking=no -o ControlPath=/home/ansibleuser/.ansible/cp/6abdc12511 -tt 10.9.88.205 ‘id mwweb || id webadm || ls -ld /web’

whereas when i remove the below two arguments from ssh my connection succeeds

1. -tt
2. -o ControlPath=/home/ansibleuser/.ansible/cp/6abdc12511

Working ssh command to be constructed by ansible.

ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o ‘IdentityFile=“/app/ssh\_keys/id\_rsa”’ -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ‘User=“root”’ -o ConnectTimeout=10 -o StrictHostKeyChecking=no 10.9.88.205 ‘id mwweb || id webadm || ls -ld /web’

This requirement (customized ssh command) is for a specific playbook for specific target hosts that is supplied as arguments to my ansible playbook below. I dont wish to modify the existing ssh configuration at OS:

- name: Play 2- Configure Source nodes  
hosts: all  
user: root  
ignore\_errors: yes  
gather\_facts: false  
tasks:

- name: Get HTTPD userid on server  
raw: id mwweb || id webadm || ls -ld /web

- name: Get OHS userid on server  
raw: id mwweb

The above playbook runs using this command:

ansible-playbook -i 10.9.88.205, -f 5 testpython.yml -vvvv

I’m using jenkin’s ansible plugin to trigger the above playbook.

Can you please suggest for the below:

can i disable -tt and ControlPath by modifying playbook code? This is my first preference. Please suggest?

If modifying the playbook wont help then how can i disable both ssh args using ansible parameters?

I was able to disable -tt using below:

ansible-playbook -i 10.9.88.205, -f 5 testpython.yml -e ansible\_ssh\_use\_tty=no -vvvv  
But, there is no way to could find to disable ControlPath despite passing -e control\_path=“”

Reference: [https://docs.ansible.com/ansible/latest/plugins/connection/ssh.html](https://docs.ansible.com/ansible/latest/plugins/connection/ssh.html)

I want the solution of disabling both ssh arguments -tt and -o ControlPath in the playbook testpython.yml or in ansible-playbook command-line.

Can you please suggest?

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [September 9, 2020, 9:42am UTC](https://forum.ansible.com/t/modify-ssh-connection-arguments-that-ansible-uses/33776/2 "2020-09-09T09:42:37Z")

</div>

[https://docs.ansible.com/ansible/latest/user\_guide/intro\_inventory.html#connecting-to-hosts-behavioral-inventory-parameters](https://docs.ansible.com/ansible/latest/user_guide/intro_inventory.html#connecting-to-hosts-behavioral-inventory-parameters)

---

<div class="post-metadata">

**Author:** ![Easy\_King](https://avatars.discourse-cdn.com/v4/letter/e/c2a13f/32.png) [@Easy\_King](https://forum.ansible.com/u/Easy_King)\
**Post date:** [September 9, 2020, 9:56am UTC](https://forum.ansible.com/t/modify-ssh-connection-arguments-that-ansible-uses/33776/3 "2020-09-09T09:56:18Z")

</div>

@Dick thank you for the link but i have been through that before.

There is no details on how we can modify my playbook testpython.yml or any command-line parameters for disabling ControlPath like we have use\_tyy

Can you further guide and help me with changes to my playbook or to the ansible-playbook command-line ?

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [September 9, 2020, 10:04am UTC](https://forum.ansible.com/t/modify-ssh-connection-arguments-that-ansible-uses/33776/4 "2020-09-09T10:04:37Z")

</div>

IIRC ControlPath is the SSH configuration option that makes pipelining work.  
So you could try to disable that:  
[https://docs.ansible.com/ansible/latest/reference\_appendices/config.html#ansible-pipelining](https://docs.ansible.com/ansible/latest/reference_appendices/config.html#ansible-pipelining)

---

<div class="post-metadata">

**Author:** ![Easy\_King](https://avatars.discourse-cdn.com/v4/letter/e/c2a13f/32.png) [@Easy\_King](https://forum.ansible.com/u/Easy_King)\
**Post date:** [September 9, 2020, 10:36am UTC](https://forum.ansible.com/t/modify-ssh-connection-arguments-that-ansible-uses/33776/5 "2020-09-09T10:36:04Z")

</div>

@Dick

I tried the below " ansible\_ssh\_pipelining: no " in my playbook but the -o ControlPath still remains.

- name: Play 2- Configure Source nodes  
hosts: all  
user: root  
ignore\_errors: yes  
gather\_facts: false  
vars:  
ansible\_ssh\_pipelining: no

tasks:

- name: Get HTTPD userid on server  
raw: id mwweb || id webadm || ls -ld /web

- name: Get OHS userid on server  
raw: id mwweb

I’m sorry but i’m new to this. Kindly suggest

---

<div class="post-metadata">

**Author:** ![Easy\_King](https://avatars.discourse-cdn.com/v4/letter/e/c2a13f/32.png) [@Easy\_King](https://forum.ansible.com/u/Easy_King)\
**Post date:** [September 9, 2020, 11:21am UTC](https://forum.ansible.com/t/modify-ssh-connection-arguments-that-ansible-uses/33776/6 "2020-09-09T11:21:24Z")

</div>

@Dick

ANSIBLE\_SSH\_ARGS=“” ansible-playbook -i 10.9.88.205, -f 5 testpython.yml -e ansible\_ssh\_use\_tty=no -vvvv works !! and i dont see the -o ControlPath anymore.

However, I stated in the original post I’m using anisble plugin inside Jenkins where i cannot find any option to specify ANSIBLE\_SSH\_ARGS=“” environment variable.

Adding ANSIBLE\_SSH\_ARGS=“” to playbook yml also does not work like below:

- name: Play 2- Configure Source nodes  
hosts: all  
user: root  
ignore\_errors: yes  
gather\_facts: false

vars:  
ansible\_ssh\_pipelining: no

ANSIBLE\_SSH\_ARGS=“”

tasks:

From the documentation, i felt passing ansible\_ssh\_arg=“” will work just how ansible\_ssh\_use\_tty=no works but that too fails to remove -o ControlPath

ansible-playbook -i 10.9.88.205, -f 5 testpython.yml -e ansible\_ssh\_use\_tty=no -e nsible\_ssh\_arg=“” -vvvv

Can you please suggest ?

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [September 9, 2020, 12:03pm UTC](https://forum.ansible.com/t/modify-ssh-connection-arguments-that-ansible-uses/33776/7 "2020-09-09T12:03:23Z")

</div>

I think this ^^ should be lower case, i.e.:

&nbsp;&nbsp;&nbsp;vars:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ansible\_ssh\_pipelining: no  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ansible\_ssh\_args: ""

---

<div class="post-metadata">

**Author:** ![Easy\_King](https://avatars.discourse-cdn.com/v4/letter/e/c2a13f/32.png) [@Easy\_King](https://forum.ansible.com/u/Easy_King)\
**Post date:** [September 9, 2020, 12:09pm UTC](https://forum.ansible.com/t/modify-ssh-connection-arguments-that-ansible-uses/33776/8 "2020-09-09T12:09:46Z")

</div>

Tried your suggestion but it does not work @Dick.

Please suggest.
