3

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?

  • What did you try? Please add the attempts to the question. – 030 Feb 26 '18 at 19:24
  • Lantronix? Please provide more details. Why are you using this? Lantronix term server, and must telnet into individual ports – 030 Feb 26 '18 at 19:25
  • Why are you considering ansible? – 030 Feb 26 '18 at 19:26
3

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.