Hi Kai,

Thank you very much for replaying on my issue. I know that it should be 
straight forward, and I just copy it on the module

I am still getting the failure message even though I changed the hosts to


[Cisco_Telnet]
10.197.48.240


Tasks:

- name: Telnet do show version for IOS
  hosts: 10.197.48.240
  gather_facts: false
  connection: local

  tasks:
    - name: show version
      telnet:
        user: ansible
        password: Inf1n1TY
        login_prompt: "Username:"
        prompts:
          - "[#]"
        command:
          - terminal length 0
          - show version


Here is the error:

PLAY [Telnet do show version for IOS] 
***************************************************************************************************************************************************************************************************************************************************************************************

TASK [show version] 
*********************************************************************************************************************************************************************************************************************************************************************************************************
fatal: [10.197.48.240]: FAILED! => {"changed": true, "msg": "Telnet action 
failed: telnet connection closed", "output": []}




Here is when i do the -vvv:

Using /etc/ansible/ansible.cfg as config file
host_list declined parsing /etc/ansible/TEMPLATES/Cisco_IOS as it did not 
pass it's verify_file() method
Skipping due to inventory source not existing or not being readable by the 
current user
script declined parsing /etc/ansible/TEMPLATES/Cisco_IOS as it did not pass 
it's verify_file() method


On Thursday, April 16, 2020 at 2:32:52 AM UTC-4, Kai Stian Olstad wrote:
>
> On Mon, Apr 13, 2020 at 01:37:13AM -0700, Zaldy B wrote: 
> > playbook is just straight forward: 
> > 
> > 
> > --- 
> > - name: Telnet do show version for IOS 
> >   hosts: Cisco_Telnet 
> >   gather_facts: false 
> >   connection: local 
> > 
> >   tasks: 
> >     - name: show version 
> >       telnet: 
> >         user: "{{ username }}" 
> >         password: "{{ password }}" 
> >         login_prompt: "Username:" 
> >         prompts: 
> >           - "[>|#]" 
> >         command: 
> >           - terminal length 0 
> >           - show version 
> > 
> > 
> > hostfile: 
> > 
> > [Cisco_Telnet] 
> > cisco_device    host=192.168.1.1   username=cisco password=cisco 
>
> This looks like a playbook just copied from documentation. 
> https://docs.ansible.com/ansible/latest/modules/telnet_module.html 
>
> Your task is missing host: default is the variable remote_addr according 
> to the 
> documentation. So you need to provide host: or sett the correct variable. 
>
> You also need to tailor the prompt for you environment, it should be a 
> list of 
> all prompt, you only have one prompt that is literally checking for [>|#] 
> I 
> doubt you prompt looks like that. 
>
> If you can't figure this out yourself you need to provide the complete 
> output 
> of telnet including telnet itself and the exit of the telnet. 
>
> -- 
> Kai Stian Olstad 
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/a0d2711e-8a5d-4d58-a0e1-41c9ae4dd93a%40googlegroups.com.

Reply via email to