On this page
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.
 
Parameters
| Parameter | Choices/Defaults | Comments | 
|---|---|---|
| command  
        required
         | 
      
        
        List of commands to be executed in the telnet session.
        
       aliases: commands  | 
     |
| host | Default: 
        "remote_addr"
         | 
      
        
        The host/target on which to execute the command
         | 
     
| login_prompt | Default: 
        "login: "
         | 
      
        
        Login or username prompt to expect
         | 
     
| password | 
        
        The password for login
         | 
     |
| password_prompt | Default: 
        "Password: "
         | 
      
        
        Login or username prompt to expect
         | 
     
| pause | Default: 
        1
         | 
      
        
        Seconds to pause between each command issued
         | 
     
| port | Default: 
        23
         | 
      
        
        Remote port to use
         | 
     
| prompts | Default: 
        ["$"]
         | 
      
        
        List of prompts expected before sending next command
         | 
     
| timeout | Default: 
        120
         | 
      
        
        timeout for remote operations
         | 
     
| user | Default: 
        "remote_user"
         | 
      
        
        The user for login
         | 
     
Notes
Note
- The 
environmentkeyword does not work with this task 
Examples
- name: send configuration commands to IOS
  telnet:
    user: cisco
    password: cisco
    login_prompt: "Username: "
    prompts:
      - "[>|#]"
    command:
      - terminal length 0
      - configure terminal
      - hostname ios01
- name: run show commands
  telnet:
    user: cisco
    password: cisco
    login_prompt: "Username: "
    prompts:
      - "[>|#]"
    command:
      - terminal length 0
      - show version
  Return Values
Common return values are documented here, the following are the fields unique to this module:
| Key | Returned | Description | 
|---|---|---|
| output  
        list
         | 
      always | 
        
        output of each command is an element in this list
         Sample:
        
       
        ['success', 'success', '', 'warning .. something']
         | 
     
Status
This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.
Maintenance
This module is flagged as community which means that it is maintained by the Ansible Community. See Module Maintenance & Support for more info.
For a list of other modules that are also maintained by the Ansible Community, see here.
Author
- Ansible Core Team
 
Hint
If you notice any issues in this documentation you can edit this document to improve it.
© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
 https://docs.ansible.com/ansible/2.6/modules/telnet_module.html