Hi Ashish, Have you tried the Telnet module?
The docs actually include IOS examples: https://docs.ansible.com/ansible/latest/modules/telnet_module.html Sample Playbook: root@f23399314267:/ansible_local/cisco_ios# cat telnet.yml --- - name: Telnet Example hosts: local_lab gather_facts: false connection: local ignore_errors: yes tasks: - name: run show commands telnet: user: cisco password: cisco login_prompt: "Username: " prompts: - "[>#]" command: - show ip int br register: output - name: Display output debug: var: output Sample Output: root@f23399314267:/ansible_local/cisco_ios# ansible-playbook -i hosts > telnet.yml > > PLAY [Telnet Example] > ************************************************************************************************************* > > TASK [run show commands] > ********************************************************************************************************** > changed: [10.1.10.101] > > TASK [Display output] > ************************************************************************************************************* > ok: [10.1.10.101] => { > "output": { > "changed": true, > "failed": false, > "output": [ > "show ip int br\r\nInterface IP-Address > OK? Method Status Protocol\r\nEthernet0 > 10.1.10.101 YES NVRAM up up \r\nLoopback0 > 10.1.0.99 YES NVRAM up up > \r\nSerial0 unassigned YES NVRAM administratively > down down \r\nSerial1 unassigned YES NVRAM > administratively down down \r\nTS-2509>" > ] > } > } > > PLAY RECAP > ************************************************************************************************************************ > 10.1.10.101 : ok=2 changed=1 unreachable=0 > failed=0 skipped=0 rescued=0 ignored=0 > > root@f23399314267:/ansible_local/cisco_ios# > > > On Sunday, March 1, 2020 at 2:26:43 AM UTC-8, Ashish Sagar wrote: > > Folks, > > I am aware that native ansible doesn't support telnet. Do we have any > alternate to test playbooks while telnet to network devices in lab > environment ? > > Thanks > Ashish > -- 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/1c9074ce-3b0e-4ba7-b836-99495ab8b8f7%40googlegroups.com.
