Telnet

86 views
Skip to first unread message

Vivek Raj

unread,
Mar 17, 2016, 8:10:20 AM3/17/16
to Ansible Project
Can any one say how to do telnet using ansible 

James Cammarata

unread,
Mar 17, 2016, 8:14:49 AM3/17/16
to ansible...@googlegroups.com
You cannot at this time. If someone REALLY wanted to, you could write your own connection plugin for this, however I seriously recommend against doing so.

James Cammarata

Ansible Lead/Sr. Principal Software Engineer
Ansible by Red Hat
twitter: @thejimic, github: jimi-c

On Wed, Mar 16, 2016 at 2:48 PM, Vivek Raj <vivi...@gmail.com> wrote:
Can any one say how to do telnet using ansible 

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/63759286-7ed5-45f2-aa03-8c2f92170f1b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Benjamin Redling

unread,
Mar 17, 2016, 10:38:47 AM3/17/16
to ansible...@googlegroups.com
On 03/16/2016 19:48, Vivek Raj wrote:
> Can any one say how to do telnet using ansible

If you just want to use telnet to check a service you could do something
like this:

# req. ansible 2.0, python >=2.6, pexpect >= 3.3
---
- hosts: 127.0.0.1
connection: local

tasks:
# if cmk -d from the omd installation isn't available at your
# management host
- expect:
command:
# grep for certain check_mk agent patch level. e.g. 1.2.6p5
/bin/bash -c "telnet myclient 6556 | grep 6p5"
responses:
\d+: ""
...

This runs "ok" if the grep finds the agents "1.2.6p" and fails otherwise.
I don't have a real use case like this.
But it is the only thing close to an ad hoc use of telnet I sometimes
fall back to (reviewing the agent output). The ad hoc case is actually
/read only/.

Benjamin
--
FSU Jena | JULIELab.de/Staff/Benjamin+Redling.html
vox: +49 3641 9 44323 | fax: +49 3641 9 44321
Reply all
Reply to author
Forward
0 new messages