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