W3cubDocs

/Ansible

telnet - Executes a low-down and dirty telnet command

New in version 2.4.

Synopsis

  • Executes a low-down and dirty telnet command, not going through the module subsystem.
  • This is mostly to be used for enabling ssh on devices that only have telnet enabled by default.

Options

parameter required default choices comments
commands
yes
List of commands to be executed in the telnet session.
host
no remote_addr
The host/target on which to execute the command
password
no
The password for login
pause
no 1
Seconds to pause between each command issued
port
no 23
Remote port to use
prompts
no [u'$']
List of prompts expected before sending next command
timeout
no 120
timeout for remote operations
user
no remote_user
The user for login

Examples

- name: send configuration commands to IOS
  telnet:
    user: cisco
    password: cisco
    login_prompt: "Username: "
    prompts:
      - "[>|#]"
    commands:
      - terminal length 0
      - configure terminal
      - hostname ios01

- name: run show commands
  telnet:
    user: cisco
    password: cisco
    login_prompt: "Username: "
    prompts:
      - "[>|#]"
    commands:
      - terminal length 0

Return Values

Common return values are documented here Return Values, the following are the fields unique to this module:

name description returned type sample
output
output of each command is an element in this list
always list ['success', 'success', '', 'warning .. something']

Notes

Note

  • The environment keyword does not work with this task

Status

This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.

For help in developing on modules, should you be so inclined, please read Community Information & Contributing, Testing Ansible and Developing Modules.

© 2012–2017 Michael DeHaan
© 2017 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/telnet_module.html