Re: [ansible-project] "VARIABLE IS NOT DEFINED!" when use {{ item }}

2021-05-28 Thread Mauricio Tavares
Call me clueless but from "stdout_lines": [ [ "Interface IP-Address OK? Method StatusProtocol", "GigabitEthernet0/0/0 42.151.182.42 YES DHCP upup"

Re: [ansible-project] "VARIABLE IS NOT DEFINED!" when use {{ item }}

2021-05-28 Thread R.B. Kumar
Hi Jatin / All Thank you solved the problem. The issue is by using {{ item }} the output format is different. By using hierarchy I am able to get the IP address greped. Thanks again to all On Friday, May 28, 2021 at 2:29:01 PM UTC+5:30 R.B. Kumar wrote: > Thank you. But gigabit and Gigbit c

Re: [ansible-project] "VARIABLE IS NOT DEFINED!" when use {{ item }}

2021-05-28 Thread R.B. Kumar
Thank you. But gigabit and Gigbit case difference is not a matter here.. All i am trying to do is, using {{ item }} i a getting a output from a Cisco Router and want to grep only a IP address value in the in output and store it in a variable. so that i can use the variable in the script regards

Re: [ansible-project] "VARIABLE IS NOT DEFINED!" when use {{ item }}

2021-05-28 Thread Antony Stone
I would suggest there is a meaningful difference between "gigabitEthernet0/0/0" and "Gigabitethernet 0/0/0". Antony. -- It is also possible that putting the birds in a laboratory setting inadvertently renders them relatively incompetent. - Daniel C Dennett

Re: [ansible-project] "VARIABLE IS NOT DEFINED!" when use {{ item }}

2021-05-28 Thread Jatin Garg
Pls see the difference in stdout outputs in both scripts and in failing script. As you are using loop so register output becomes bit changed so you will have to use your logic as per loop output. You can call me. No. shared seperately. On Fri, May 28, 2021, 14:10 R.B. Kumar wrote: > Hello - The

Re: [ansible-project] "VARIABLE IS NOT DEFINED!" when use {{ item }}

2021-05-28 Thread R.B. Kumar
Hello - The difference between working and not working script is given below. Need to find out why we get "VARIABLE IS NOT DEFINED" in script-1 *NOT WORKING SCRIPT* *(SCRIPT-1)* - name: get_ip ios_command: provider: "{{ cli }}" commands: "show ip interface brief *{{ item }

Re: [ansible-project] "VARIABLE IS NOT DEFINED!" when use {{ item }}

2021-05-28 Thread Jatin Garg
So would it work if you just use stdout or is split required? If split is required, pls show me the stdout output and what you need from this value? On Fri, May 28, 2021, 13:48 R.B. Kumar wrote: > Thank you.. Just by printing stdout, it shows all the data perfectly. But > when i try to grep it

Re: [ansible-project] "VARIABLE IS NOT DEFINED!" when use {{ item }}

2021-05-28 Thread R.B. Kumar
Hello - I attached the output of debug when i used {{ item }}. That is show ip interface brief {{ item }}. I am trying to capture the IP address in the output and reuse it in the script. TASK [debug]

Re: [ansible-project] "VARIABLE IS NOT DEFINED!" when use {{ item }}

2021-05-28 Thread R.B. Kumar
Thank you.. Just by printing stdout, it shows all the data perfectly. But when i try to grep it using split, it is showing "VARIABLE IS NOT FOUND" TASK [debug] *** ok: [labrtr2.allmerica.

Re: [ansible-project] "VARIABLE IS NOT DEFINED!" when use {{ item }}

2021-05-28 Thread Jatin Garg
Please try to print stdout value first and see what does it contain. Stdout_lines may have your data. On Fri, May 28, 2021, 13:38 R.B. Kumar wrote: > Hello All - I am using Ansible version 2.7.18 > > I am trying this code to get IP address of the Cisco Router interface. > When i use {{ item }},

[ansible-project] "VARIABLE IS NOT DEFINED!" when use {{ item }}

2021-05-28 Thread R.B. Kumar
Hello All - I am using Ansible version 2.7.18 I am trying this code to get IP address of the Cisco Router interface. When i use {{ item }}, the IP address is not captured. Where as if i use a static value (eg: show ip interface brief gig 0/0/0), the IP address is captured and i can use it in th