ansible.netcommon.telnet (6.1.0) — module

Executes a low-down and dirty telnet command

| "added in version" 1.0.0 of ansible.netcommon"

Authors: Ansible Core Team

This plugin has a corresponding action plugin.

Install collection

Install with ansible-galaxy collection install ansible.netcommon:==6.1.0


Add to requirements.yml

  collections:
    - name: ansible.netcommon
      version: 6.1.0

Description

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.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: send configuration commands to IOS
  ansible.netcommon.telnet:
    user: cisco
    password: cisco
    login_prompt: "Username: "
    prompts:
      - "[>#]"
    command:
      - terminal length 0
      - configure terminal
      - hostname ios01
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: run show commands
  ansible.netcommon.telnet:
    user: cisco
    password: cisco
    login_prompt: "Username: "
    prompts:
      - "[>#]"
    command:
      - terminal length 0
      - show version

Inputs

    
crlf:
    default: false
    description:
    - Sends a CRLF (Carrage Return) instead of just a LF (Line Feed).
    required: false
    type: bool

host:
    default: remote_addr
    description:
    - The host/target on which to execute the command
    required: false
    type: str

port:
    default: 23
    description:
    - Remote port to use
    type: int

user:
    default: remote_user
    description:
    - The user for login
    required: false
    type: str

pause:
    default: 1
    description:
    - Seconds to pause between each command issued
    required: false
    type: int

command:
    aliases:
    - commands
    description:
    - List of commands to be executed in the telnet session.
    elements: str
    required: true
    type: list

prompts:
    default:
    - $
    description:
    - List of prompts expected before sending next command
    elements: str
    required: false
    type: list

timeout:
    default: 120
    description:
    - timeout for remote operations
    type: int

password:
    description:
    - The password for login
    type: str

login_prompt:
    default: 'login: '
    description:
    - Login or username prompt to expect
    required: false
    type: str

send_newline:
    default: false
    description:
    - Sends a newline character upon successful connection to start the terminal session.
    required: false
    type: bool

password_prompt:
    default: 'Password: '
    description:
    - Login or username prompt to expect
    required: false
    type: str

Outputs

output:
  description: output of each command is an element in this list
  returned: always
  sample:
  - success
  - success
  - ''
  - warning .. something
  type: list