Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gns3 iosv telnet #580

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions docs/ansible.netcommon.telnet_module.rst
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,25 @@ Parameters
<div>List of prompts expected before sending next command</div>
</td>
</tr>
<tr>
<td colspan="1">
<div class="ansibleOptionAnchor" id="parameter-"></div>
<b>send_carriage_return</b>
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
<div style="font-size: small">
<span style="color: purple">boolean</span>
</div>
</td>
<td>
<ul style="margin: 0; padding: 0"><b>Choices:</b>
<li><div style="color: blue"><b>no</b>&nbsp;&larr;</div></li>
<li>yes</li>
</ul>
</td>
<td>
<div>Sends a carriage return character upon successful connection to start the terminal session, this occurs before send_newline option.</div>
</td>
</tr>
<tr>
<td colspan="1">
<div class="ansibleOptionAnchor" id="parameter-"></div>
Expand Down
3 changes: 3 additions & 0 deletions plugins/action/telnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def run(self, tmp=None, task_vars=None):
timeout = int(self._task.args.get("timeout", 120))
pause = int(self._task.args.get("pause", 1))

send_carriage_return = self._task.args.get("send_carriage_return", False)
send_newline = self._task.args.get("send_newline", False)

login_prompt = to_text(self._task.args.get("login_prompt", "login: "))
Expand All @@ -63,6 +64,8 @@ def run(self, tmp=None, task_vars=None):

self.output = bytes()
try:
if send_carriage_return:
self.tn.write(b"\r")
if send_newline:
self.tn.write(b"\n")

Expand Down
7 changes: 7 additions & 0 deletions plugins/modules/telnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,19 @@
required: false
type: int
default: 1
send_carriage_return:
description:
- Sends a carriage return character upon successful connection to start the terminal session, this occurs before send_newline option.
required: false
type: bool
default: false
send_newline:
description:
- Sends a newline character upon successful connection to start the terminal session.
required: false
type: bool
default: false

notes:
- The C(environment) keyword does not work with this task
author:
Expand Down
Loading