<p>Ansible provides a module for telnet provisioning. See:</p>

<p><a href="https://docs.ansible.com/ansible/latest/modules/telnet_module.html" rel="nofollow noreferrer">https://docs.ansible.com/ansible/latest/modules/telnet_module.html</a></p>

CC BY-SA 4.0
2019-08-11T00:58:03.587Z
2019-08-11T00:58:03.587Z
mcandre
<p>As documented <a href="http://docs.ansible.com/ansible/devel/plugins/connection.html" rel="noreferrer">here</a>, ansible does not support telnet as connection plugin. This means you cannot use ansible to connect to a remote machine via telnet and execute any of the ansible modules.</p>

<p>However, you can use <code>connection: local</code> for local connection(run ansible against the machine that is running it) and send <a href="http://docs.ansible.com/ansible/2.4/telnet_module.html" rel="noreferrer"><code>telnet</code> commands</a> from the machine where ansible runs.</p>

<p>Example playbook will look something like that:</p>

<pre><code>---
- hosts: localhost
  connection: local
  gather_facts: false

  tasks:
    - name: my first telnet task
      telnet:
        username: user
        password: pass
        command:
          - my command
</code></pre>

CC BY-SA 4.0
2020-10-15T23:34:51.307Z
Where are you specifying the remote device that you are telneting to? It looks like you are just telneting the localhost.
Frak
CC BY-SA 4.0
2020-10-17T16:51:07.577Z
nowhere; If you read carefuly I say "Example playbook will look something like that:"; Nowhere I even try to suggest a remote connection. I don't understand your question?
man0v
CC BY-SA 3.0
2018-02-26T14:31:34.063Z
2018-02-27T19:30:07.190Z
2018-02-27T19:30:07.190Z
man0v
<p>Was wondering how to best utilize telnet, rather than SSH, with ansible.
We are using a Lantronix term server, and must telnet into individual ports.</p>

<p>More specifically, would it be best to use a specific telnet module? If so, which is most intuitive. 
Alternatively, is it more efficient to simply modify connection type within the hosts file / YAML playbook?</p>

CC BY-SA 3.0
2018-02-26T19:24:25.787Z
What did you try? Please add the attempts to the question.
030
CC BY-SA 3.0
2018-02-26T19:25:49.853Z
Lantronix? Please provide more details. Why are you using this? `Lantronix term server, and must telnet into individual ports`
030
CC BY-SA 3.0
2018-02-26T19:26:24.677Z
Why are you considering ansible?
030
<ansible>
Utilizing telnet with Ansible
Andrew H
# Utilizing telnet with Ansible

(Asked by: username_0 on 2018-02-26)

Was wondering how to best utilize telnet, rather than SSH, with ansible.
We are using a Lantronix term server, and must telnet into individual ports.

More specifically, would it be best to use a specific telnet module? If so, which is most intuitive.
Alternatively, is it more efficient to simply modify connection type within the hosts file / YAML playbook?

**Tags:** ansible

> **Comments:**
> **username_1**: What did you try? Please add the attempts to the question.  
> **username_1**: Lantronix? Please provide more details. Why are you using this? `Lantronix term server, and must telnet into individual ports`  
> **username_1**: Why are you considering ansible?  

---

## 2 answers

### Answer by username_3 on 2018-02-26. Score: 6 | Accepted answer

As documented here, ansible does not support telnet as connection plugin. This means you cannot use ansible to connect to a remote machine via telnet and execute any of the ansible modules.
However, you can use connection: local for local connection(run ansible against the machine that is running it) and send telnet commands from the machine where ansible runs.
Example playbook will look something like that:
---
- hosts: localhost
  connection: local
  gather_facts: false

  tasks:
    - name: my first telnet task
      telnet:
        username: user
        password: pass
        command:
          - my command

> **Comments:**
> **username_4**: Where are you specifying the remote device that you are telneting to? It looks like you are just telneting the localhost.  
> **username_3**: nowhere; If you read carefuly I say "Example playbook will look something like that:"; Nowhere I even try to suggest a remote connection. I don't understand your question?  

---

### Answer by username_2 on 2019-08-11. Score: 2

Ansible provides a module for telnet provisioning. See:

<https://docs.ansible.com/ansible/latest/modules/telnet_module.html>


---

