Re: [ansible-project] Ping Host from Ansible Server

2021-06-16 Thread R.B. Kumar
: > On Wednesday 16 June 2021 at 17:21:33, R.B. Kumar wrote: > > > Hello All - I am trying to do a ping test of all the hosts in > > /etc/ansible/hosts, from the Ansible server. > > > > So the requirement is, the ansible server should do a ping test to all > the > >

[ansible-project] Ping Host from Ansible Server

2021-06-16 Thread R.B. Kumar
Hello All - I am trying to do a ping test of all the hosts in /etc/ansible/hosts, from the Ansible server. So the requirement is, the ansible server should do a ping test to all the host and return the output. regards,Kumar -- You received this message because you are subscribed to the

Re: [ansible-project] Ping Host from Ansible Server

2021-06-17 Thread R.B. Kumar
Thanks again. But i am looking for a solution to Ping all the hosts defined in /etc/ansible/host file, from the Ansible server itself. Ansible Server where i am running the script should do a ping test to all the host i defined in the Inventory file. will delegate_to: localhost work. I didnt

[ansible-project] Re: Handling Prompt in Cisco IOS_CONFIG module

2021-05-31 Thread R.B. Kumar
ot;Are you sure you want to do this" answer: 'yes' loop: - config t - no crypto pki trustpoint CTA On Monday, May 31, 2021 at 3:40:07 PM UTC+5:30 R.B. Kumar wrote: > Can anybody have requirement similar to this? I tried with cli_command, > ios_command too.. &

Re: [ansible-project] Print output of multiple host in a single file

2021-06-02 Thread R.B. Kumar
Thank you. Let me try and let you know On Wednesday, June 2, 2021 at 6:01:50 PM UTC+5:30 navee...@gmail.com wrote: > May be u can use with_items module. > > On Wed, Jun 2, 2021, 17:52 R.B. Kumar wrote: > >> Hello All - Some basics. I have 50+ Cisco Routers. I am running a

[ansible-project] Print output of multiple host in a single file

2021-06-02 Thread R.B. Kumar
Hello All - Some basics. I have 50+ Cisco Routers. I am running a ansible script to execute "show version" command. The script works well. I am copying the output to a file But every host creates one file so, i end up having 50+ files with the output. Can i write the output of all the host

[ansible-project] Using Variable inside IOS_CONFIG

2021-05-29 Thread R.B. Kumar
Hello Everyone - Need your help When I use a variable inside *ios_config* I am getting an error. The error message is below. *Goal* 1. Caputre an IP addresses from "show ip interface brief" from Cisco Router 2. Register the Output in *var_ip_address* 3. Grep one of the IP address using

[ansible-project] Loop to Print same name multiple times

2021-05-30 Thread R.B. Kumar
Hello Everyone - I am aware we can use *with_items *and *loop *methods to create a iterative loops in Ansible. Is there a logic to use kind of "for loops" For example, i want to execute one Cisco command in the same Router continuously for 10 times .. How to do this in Ansible? i am looking

[ansible-project] Handling Prompt in Cisco IOS_CONFIG module

2021-05-30 Thread R.B. Kumar
Hello All - Using Ansible v2.7 I am tying to execute Cisco IOS commands that prompts to type Y/N. Looks like the *Prompt: *is not available in *ios_config *module. For example - name: delete_crypto_map ios_config: lines: - no crypto pki trustpoint CTA - yes The above script

[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

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

2021-05-28 Thread R.B. Kumar
2.42 YES DHCP upup" ], "stdout_lines": [ [ "Interface IP-Address OK? Method StatusProtocol", "GigabitEthernet0

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

2021-05-28 Thread R.B. Kumar
quot;var_ip_addr_0.stdout[0].split('\n')[1].split()[1]": *"42.151.182.42"* } On Friday, May 28, 2021 at 1:57:59 PM UTC+5:30 jatin@gmail.com wrote: > So would it work if you just use stdout or is split required? > > If split is required, pls show me the stdout output and

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

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

2021-05-28 Thread R.B. Kumar
tin@gmail.com wrote: > 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

Re: [ansible-project] Using Variable inside IOS_CONFIG

2021-05-30 Thread R.B. Kumar
: > Try -- set_fact the grep output and try to call the variable in ios_config > > set_fact: > desired_ntp: {{ var_ip_address.stdout[0].split('\n')[1].split()[1] }} > > On Sun, May 30, 2021 at 12:25 AM R.B. Kumar wrote: > >> Hello Everyone - Need your help >>

Re: [ansible-project] Print output of multiple host in a single file

2021-06-03 Thread R.B. Kumar
be happy to help with the setup. > On Wednesday, 2 June 2021 at 17:39:23 UTC+1 seeku...@gmail.com wrote: > >> Thank you. Let me try and let you know >> >> On Wednesday, June 2, 2021 at 6:01:50 PM UTC+5:30 navee...@gmail.com >> wrote: >> >>> May be u ca

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 Gig

[ansible-project] Register variable using {{ item }}

2021-05-28 Thread R.B. Kumar
Hello Everyone again - Trying to get the IP address of the multiple Interfaces from a Cisco Router and register it. Using {{ item }} loop method to feed the Multiple Interfaces (eg: GigabitEthernet 0/0/0) in the command. How to get the unique variables for each interface? I will pick those

[ansible-project] Re: Register variable using {{ item }}

2021-05-28 Thread R.B. Kumar
ot;: "Loopback 0", * "stdout": [* "Interface IP-Address OK? Method StatusProtocol\nLoopback0 172.31.246.246 YES NVRAM upup" ], &

Re: [ansible-project] Re: Register variable using {{ item }}

2021-05-28 Thread R.B. Kumar
Thank you Vladimir. I will try in to add in my script and try. Thanks again a lot On Friday, May 28, 2021 at 9:14:35 PM UTC+5:30 vbo...@gmail.com wrote: > On Fri, 28 May 2021 08:21:43 -0700 (PDT) > "R.B. Kumar" wrote: > > > ... where the lines you shown here

Re: [ansible-project] Re: Register variable using {{ item }}

2021-05-28 Thread R.B. Kumar
Thank you Vladimir - Much appreciated your response. Unfortunately, I am a ansible noob and trying to learn the things for a realtime network requirements If you can help me where the lines you shown here will fit in my script. My script is below - name: get_ip ios_command:

[ansible-project] Re: Handling Prompt in Cisco IOS_CONFIG module

2021-05-31 Thread R.B. Kumar
Can anybody have requirement similar to this? I tried with cli_command, ios_command too.. On Monday, May 31, 2021 at 2:15:09 AM UTC+5:30 R.B. Kumar wrote: > Hello All - Using Ansible v2.7 > I am tying to execute Cisco IOS commands that prompts to type Y/N. Looks > like th