Answers: <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>
  
Answers: CC BY-SA 4.0
Answers: 2019-08-11T00:58:03.587Z
Answers: 2019-08-11T00:58:03.587Z
Answers: mcandre
Answers: <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>
  
Answers: CC BY-SA 4.0
Answers: 2020-10-15T23:34:51.307Z
Answers: Where are you specifying the remote device that you are telneting to? It looks like you are just telneting the localhost.
Answers: Frak
Answers: CC BY-SA 4.0
Answers: 2020-10-17T16:51:07.577Z
Answers: 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?
Answers: man0v
Answers: CC BY-SA 3.0
Answers: 2018-02-26T14:31:34.063Z
Answers: 2018-02-27T19:30:07.190Z
Answers: 2018-02-27T19:30:07.190Z
Answers: man0v
Body: <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>
  
Comments: CC BY-SA 3.0
Comments: 2018-02-26T19:24:25.787Z
Comments: What did you try? Please add the attempts to the question.
Comments: 030
Comments: CC BY-SA 3.0
Comments: 2018-02-26T19:25:49.853Z
Comments: Lantronix? Please provide more details. Why are you using this? `Lantronix term server, and must telnet into individual ports`
Comments: 030
Comments: CC BY-SA 3.0
Comments: 2018-02-26T19:26:24.677Z
Comments: Why are you considering ansible?
Comments: 030
Tags: <ansible>
Title: Utilizing telnet with Ansible
UserDisplayName: Andrew H
ThreadText: # 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](http://docs.ansible.com/ansible/devel/plugins/connection.html), 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](http://docs.ansible.com/ansible/2.4/telnet_module.html) 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>
  
  
  ---
  
  