What I would like to do it's like this debut output :
TASK [Get system]
******************************************************************************************************************************************************************************
task path: /home/user/playbooks/pb_banner.yml:24
<1.1.1.1> attempting to start connection
<1.1.1.1> using connection plugin network_cli
<1.1.1.1> local domain socket does not exist, starting it
<1.1.1.1> control socket path is /home/user/.ansible/pc/d7df86492e
<1.1.1.1> CUSTOM NETWORK_CLI MODULE
<1.1.1.1> <1.1.1.1> ESTABLISH PARAMIKO SSH CONNECTION FOR USER: user on
PORT 22 TO 1.1.1.1
<1.1.1.1> <1.1.1.1> ssh connection done, setting terminal
<1.1.1.1> <1.1.1.1> loaded terminal plugin for network_os fortios
<1.1.1.1> <1.1.1.1> loaded cliconf plugin for network_os fortios
<1.1.1.1> <1.1.1.1> Response received, triggered
'persistent_buffer_read_timeout' timer of 0.1 seconds
<1.1.1.1> <1.1.1.1> firing event: on_open_shell()
<1.1.1.1> prompt detected on device DEVICENAME # <<<<====
The last line is printed during the call of "on_open_shell" in the
"terminal_plugins" (bellow, the source code), as you can see, I use
"Display()".
def on_open_shell(self):
prompt = self._get_prompt()
if re.search("Press 'a' to accept", prompt):
self._exec_cli_command(b'a')
if prompt:
display.display('prompt detected on device ' + prompt)
And now I would like to have the same kind of log in the "debug mode
(-vvvv)", but from a cliconf_plugin.
I dont want to like into a file.
I hope i'm clear :) thanks for your help !
Le lundi 15 juillet 2019 16:40:02 UTC+2, Hackcurly a écrit :
>
> Hi,
>
> I would like to know how to log some variable or other useful information
> directly in the "Ansible log" displayed when using "-vvvv".
>
> I tried Display(), but it seems to be not in the same "context".
>
> So what do you advice for log information into a custom module ?
>
> Thanks :)
>
--
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/6dd52445-c43d-46c7-b5e5-42df9e592361%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.