# How Network Modules using openssh controlpersist  feature?

**URL:** <https://forum.ansible.com/t/how-network-modules-using-openssh-controlpersist-feature/22594>\
**Category:** Ansible Project\
**Created:** [September 20, 2016, 1:48pm UTC](https://forum.ansible.com/t/how-network-modules-using-openssh-controlpersist-feature/22594 "2016-09-20T13:48:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jacky.gao2016](https://avatars.discourse-cdn.com/v4/letter/j/e9bcb4/32.png) [@jacky.gao2016](https://forum.ansible.com/u/jacky.gao2016)\
**Post date:** [September 20, 2016, 1:48pm UTC](https://forum.ansible.com/t/how-network-modules-using-openssh-controlpersist-feature/22594/1 "2016-09-20T13:48:10Z")

</div>

I find that the Network Modules must use paramiko, does paramiko support openssh ControlPersist similar feature?

building ssh connection by paramiko: Code in module\_util/shell.py

```auto

def open(self, host, port=22, username=None, password=None,
        timeout=10, key_filename=None, pkey=None, look_for_keys=None,
        allow_agent=False):

    self.ssh = paramiko.SSHClient()
    self.ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())

```

---

<div class="post-metadata">

**Author:** ![psprygada](https://avatars.discourse-cdn.com/v4/letter/p/898d66/32.png) [@psprygada](https://forum.ansible.com/u/psprygada)\
**Post date:** [September 20, 2016, 7:26pm UTC](https://forum.ansible.com/t/how-network-modules-using-openssh-controlpersist-feature/22594/2 "2016-09-20T19:26:27Z")

</div>

No, there is no support for ControlPersist (or similar) in the paramiko library.

---

<div class="post-metadata">

**Author:** ![jacky.gao2016](https://avatars.discourse-cdn.com/v4/letter/j/e9bcb4/32.png) [@jacky.gao2016](https://forum.ansible.com/u/jacky.gao2016)\
**Post date:** [September 21, 2016, 11:24am UTC](https://forum.ansible.com/t/how-network-modules-using-openssh-controlpersist-feature/22594/3 "2016-09-21T11:24:00Z")

</div>

**If I want to use openssh ControlPersist function or similar feature, I can’t use module\_util/shell.y & basic.y, I have to write myself basc library?**

**Is there any other featuca to avoid SSH authentication for each task?**

在 2016年9月21日星期三 UTC+8上午3:26:33，Peter Sprygada写道：

---

<div class="post-metadata">

**Author:** ![psprygada](https://avatars.discourse-cdn.com/v4/letter/p/898d66/32.png) [@psprygada](https://forum.ansible.com/u/psprygada)\
**Post date:** [September 22, 2016, 9:21pm UTC](https://forum.ansible.com/t/how-network-modules-using-openssh-controlpersist-feature/22594/4 "2016-09-22T21:21:38Z")

</div>

If I want to use openssh ControlPersist function or similar feature, I can’t use module\_util/shell.y & basic.y, I have to write myself basc library?

> Yes, it would require a completely new SSH library (or changes to paramiko) to support the same functionality as ControlPersist. The updates would also have to account for each channel being able to invoke an emulated shell connection.

Is there any other featuca to avoid SSH authentication for each task?
