[ansible-project] Re: How to make ansible ignore a group name in hosts file if it has no ip?

2021-12-15 Thread Vikram S
: - name: End playbook if connection IP is not defined meta: end_host when: {{ ansible_host }} is not defined Thanks, Vikram On Wednesday, 15 December, 2021 at 9:45:07 pm UTC+5:30 Vikram S wrote: > I have 2 groups created in hosts file as given below

[ansible-project] How to make ansible ignore a group name in hosts file if it has no ip?

2021-12-15 Thread Vikram S
I have 2 groups created in hosts file as given below. I have a playbook consisting of 2 plays - the 1st play will be executed on IP in 'ACTIVEFIREWALL' group and 2nd play will be executed on IP in 'STANDBYFIREWALL' group. Many a times, i have no ip to be give for 'STANDBYFIREWALL' group (so

[ansible-project] Need info on any known issues for a paramiko/ ansible version

2021-10-27 Thread Vikram S
Hi, I am using ansible 2.10.8 with python 3.9.2 and running ansible on Windows subsystem for linux (debian linux). Pramiko version is paramiko==2.7.2. I am seeing some network modules freezing for no apparent reason. Please refer to this post for details

[ansible-project] ASA_command module freezes for no apparent reason

2021-10-23 Thread Vikram S
Hi, I have a written a script to do IOS upgrade of active-standby ASA firewall. Script first upgrades standby firewall and does post-upgrade verification and then switches to active firewall to upgrade it (multiple plays in a playbook). Using ansible 2.10 with python 3 in WSL linux. After

[ansible-project] reload command not working properly for asa_command module

2021-10-16 Thread Vikram S
I wrote below script to reload ASA firewall. The script reloads ASA firewall but the fact that reload has happened does not get passed back to ansible. So the script waits forever until command_timeout occurs. I tried some alternate solutions and none of them worked: 1. Changed

[ansible-project] Need info on the commands used by ios_facts module

2021-10-14 Thread Vikram S
We plan to do ios upgrade and I am using ios_facts module to compare/manipulate info. There is a team to which we have given limited access to network devices and need to know what command does ios_facts module execute on cisco devices to gather the info that it does? So we will give access

Re: [ansible-project] the global ansible_command_timeout seems to override TASK level ansible_command_timeout

2021-08-31 Thread Vikram S
that indicates this. Regards, Vikram On Wednesday, 1 September, 2021 at 2:26:16 am UTC+5:30 Vikram S wrote: > Hi Dick, > > I assumed script and playbook were synonymous with each other. I ran > playbook using the command ansible-playbook sample.yaml. Again, i didn't > mention it be

Re: [ansible-project] the global ansible_command_timeout seems to override TASK level ansible_command_timeout

2021-08-31 Thread Vikram S
. But both your points noted. Thanks, Vikram On Wednesday, 1 September, 2021 at 1:37:54 am UTC+5:30 dick@geant.org wrote: > Not an actual answer but some hints for the future > > On Tue, 31 Aug 2021 at 20:10, Vikram S wrote: > >> Hi, >> >> Iam using Ansible 2

[ansible-project] the global ansible_command_timeout seems to override TASK level ansible_command_timeout

2021-08-31 Thread Vikram S
Hi, Iam using Ansible 2.10 with python 3 in WSL linux. In ansible.cfg file, i set global timeout value as 180. i also set much higher ansible_command_timeout value for certain tasks. However these tasks end in error as ansible shows that command timeout of 180 secs happened. So for some

[ansible-project] need assistance to extract a text using Regex

2021-08-29 Thread Vikram S
In below output taken from a cisco switch, i need to extract only 'c2960x-universalk9-mz.155-4.E1.bin', c2960x-universalk9-mz.155-2a.EX5, c2960x-universalk9-mz.155-7.E3 from each line. I wrote below script to extract using Regex and specified that any text after :30 be extractd. But issue is

[ansible-project] tried to use pre-defined variable in WHEN conditional but not working, please assist

2021-08-25 Thread Vikram S
Hi, Below is the output of a command i executed in cisco router. I wrote a TASK to extract only 'isr4300-universalk9.16.15.04.SPA.bin' using Regex from the output and put in a custom variable. Then i ran ios_facts module and one of the pre-defined variable in ios_facts is ansible_net_version.

[ansible-project] I extracted a string using Regex but it doesn't display as i expected it to, please help

2021-08-25 Thread Vikram S
Hi, i need to write a script that will gather the ios image present in cisco router/switch and delete it. Below is the output of command executed on a router for reference and iam including this command in script. I used regex to first extract only

Re: [ansible-project] getting error when trying to use 'at' module to schedule a script

2021-08-24 Thread Vikram S
wrote: > Check kron module, it's similar to at. > > On Mon, 23 Aug, 2021, 6:19 am Vikram S, wrote: > >> Hi Erik, >> >> no, i wanted to schedule a script to be run on a cisco switch/firewall >> (network device). i don't think 'at' module can be install

Re: [ansible-project] getting error when trying to use 'at' module to schedule a script

2021-08-22 Thread Vikram S
dule.html#requirements > > On Sat, Aug 21, 2021 at 11:10 PM Vikram S wrote: > >> I tried to schdule a script to be run at a particular time as per the >> instruction in documentation for 'at' module. However iam getting below >> error. Not sure what iam doing wrong

[ansible-project] getting error when trying to use 'at' module to schedule a script

2021-08-21 Thread Vikram S
I tried to schdule a script to be run at a particular time as per the instruction in documentation for 'at' module. However iam getting below error. Not sure what iam doing wrong, please guide. First, i wrote a script which references another script that need to be executed in 5 minutes.

[ansible-project] need assistance to gather access list rules associated with public ip's only using ansible

2021-08-18 Thread Vikram S
i need to gather firewall rules (ACL) in which source ip is a public ip or public subnet and destination is an internal server and port is tcp/3389. I am wondering how to write a script that will excluded all ACL in which source ip is internal (starting with 10.xx.xx.xx) and gather only ACL

[ansible-project] need assistance to gather access list rules associated with public ip's only using ansible

2021-08-18 Thread Vikram S
i need to gather firewall rules (ACL) in which source ip is a public ip or public subnet and destination is an internal server and port is tcp/3389. I am wondering how to write a script that will excluded all ACL in which source ip is internal (starting with 10.xx.xx.xx) and gather only ACL

Re: [ansible-project] need assisatnce in writing script for active-standby ASA firewall

2021-08-08 Thread Vikram S
ction before you do the > arp, else you won't get the output. > > On Mon, 9 Aug, 2021, 12:28 am Vikram S, wrote: > >> Hi, >> >> Thanks for your suggestion but i just now checked asa_facts doesn't >> gather mac address. The modules for ASA are not as feature rich nor

Re: [ansible-project] need assisatnce in writing script for active-standby ASA firewall

2021-08-08 Thread Vikram S
n use jinja template for preparing the report. > > On Sun, 8 Aug, 2021, 10:17 pm Vikram S, wrote: > >> I am trying to write a script for IOS upgrade of active-standby ASA >> firewall (failover pair). >> >> 2 firewalls are configured as Active-standby

[ansible-project] need assisatnce in writing script for active-standby ASA firewall

2021-08-08 Thread Vikram S
I am trying to write a script for IOS upgrade of active-standby ASA firewall (failover pair). 2 firewalls are configured as Active-standby firewall for failover purpose. Which means if the active firewall goes down, standby firewall automatically becomes the active and standby also takes

Re: [ansible-project] fact caching no longer works after upgrading to Ansible 2.11

2021-07-27 Thread Vikram S
Hi Brian, In the script mentioned earlier, the output of a command which is stored as custom variable 'show_bootinfo' would be stored in the file (pasting that part of the script below) and i have viwed the output in the file. But i no longer see output of custom variables stored in the file

Re: [ansible-project] fact caching no longer works after upgrading to Ansible 2.11

2021-07-27 Thread Vikram S
Hi Brian, Below is my playbook. As you can see, i am gathering device facts (using ios_facts) and also saving the output of a output in a custom variable. I have the given the contents of file saved by fact cache plugin below the script, as you can see only the ios_facts output is saved. I

Re: [ansible-project] fact caching no longer works after upgrading to Ansible 2.11

2021-07-27 Thread Vikram S
Hi Brian, Below is my playbook. As yoiu can see, i am gathering device facts (using ios_facts) and saving the output of a output in a custom variable. I have the given the contents of file saved by fact cache plugin below the script, as you can see only the ios_facts output is saved. I

[ansible-project] fact caching no longer works after upgrading to Ansible 2.11

2021-07-25 Thread Vikram S
Hi, I had enabled fact caching using below commands when i was earlier using ansible 2.9 with python 2.7 (not sure about minor version though i know major version was python 2.xx) in WSL linux. ASA facts module didn't work with ansible 2.9. So i had to upgrade to ansible 2.11.2 with pythin

[ansible-project] Request assistance to write script using Regex

2021-07-13 Thread Vikram S
Hi Team, >From the below output, i need to extract only the IP 10.1.1.10 (it is ok if the entire line starting from asterix is extracted). I wrote below script and it seemed to work when i tested in regex101.com but failing when i used it in playbook. What am i doing wrong? How can it be

[ansible-project] Request assistance to write script using Regex

2021-07-13 Thread Vikram S
>From the below output, i need to extract only the IP 10.1.1.10 (it is ok if the entire line starting from asterix is extracted). I wrote below script and it seemed to work when i tested in regex101.com but failing when i used it in playbook. What am i doing wrong? How can it be improved?

Re: [ansible-project] Need clarification on set_fact module

2021-06-21 Thread Vikram S
, Vikram On Monday, 21 June, 2021 at 11:56:30 pm UTC+5:30 dick@geant.org wrote: > On Mon, 21 Jun 2021 at 19:09, Vikram S wrote: > >> Ansible documentation for set_fact module says "Set cacheable to yes to >> save variables across executions using a fact cache". >

Re: [ansible-project] Need clarification on set_fact module

2021-06-21 Thread Vikram S
Hi, Yes, i did. As i have given in above script, below command is added to the task. cacheable: yes Regards, Vikram On Monday, 21 June, 2021 at 11:56:30 pm UTC+5:30 dick@geant.org wrote: > On Mon, 21 Jun 2021 at 19:09, Vikram S wrote: > >> Ansible documentation for set_fact

Re: [ansible-project] Need clarification on set_fact module

2021-06-21 Thread Vikram S
Hi, Yes, i run them against the same host. But both these playbooks are executed separately. Regards, Vikram On Monday, 21 June, 2021 at 10:57:01 pm UTC+5:30 dick@geant.org wrote: > Are these plays run against the same host? > > On Mon, 21 Jun 2021 at 19:09, Vikram S wrote: >

[ansible-project] Need clarification on set_fact module

2021-06-21 Thread Vikram S
Ansible documentation for set_fact module says "Set cacheable to yes to save variables across executions using a fact cache". So my understanding is that setting 'cacheable: yes' would make the contents of custom variable available across differnt playbooks (as opposed to default behaviour of

[ansible-project] How do i save output of 2 TASKS to same file?

2021-06-12 Thread Vikram S
Hi, In below script, i am saving backup of several router commands into a file using 'copy' module. Then i have written the script in such a way that EIGRP Neigbour backup should be taken only if EIGRP protcol is running and saved to another file. Is there any way i can save backup of both of

Re: [ansible-project] Need assistance in using 'AND' and 'OR' condition together

2021-06-03 Thread Vikram S
1 at 21:31:21, Vikram S wrote: > > > I have written below script that will end the playbook if IOS version > > running on router satisfies below conditions: > > > > 1. Version is greater than or is 16.12.02 AND > > 2. Version is NOT certain versions like 16.12.05

Re: [ansible-project] Need assistance in using 'AND' and 'OR' condition together

2021-06-02 Thread Vikram S
fail. Somy issue is that this AND and OR condition don't work when used together but work when used separately. Regards, Vikram On Thursday, 3 June, 2021 at 1:18:08 am UTC+5:30 Antony Stone wrote: > On Wednesday 02 June 2021 at 21:31:21, Vikram S wrote: > > > I have wri

[ansible-project] Need assistance in using 'AND' and 'OR' condition together

2021-06-02 Thread Vikram S
I have written below script that will end the playbook if IOS version running on router satisfies below conditions: 1. Version is greater than or is 16.12.02 AND 2. Version is NOT certain versions like 16.12.05 OR 16.09.06 OR 17.03.02', etc as mentioned below.

Re: [ansible-project] How to display verbose only for a particular task in playbook?

2021-06-02 Thread Vikram S
for these. You can refer logcallback >>> plugin in ansible. >>> >>> Create a copy of it and customize it as per your need. >>> >>> >>> On Wed, Jun 2, 2021, 1:37 AM Vikram S wrote: >>> >>>> I have several tasks in a playbo

Re: [ansible-project] How to display verbose only for a particular task in playbook?

2021-06-02 Thread Vikram S
un 2, 2021 at 1:37 AM Vikram S wrote: > >> I have several tasks in a playbook. I want to see - (highest verbose >> level) only for a single task in the playbook. So i don't want to give >> - after 'ansible-playbook sample.yaml'. >> >> Is there any

[ansible-project] How to run 2 tasks simultaneously in playbook?

2021-06-01 Thread Vikram S
I have several tasks defined in a playbook and there are 2 tasks in middle of the playbook that i would like to run simultaneously. I also want to wait for both these tasks to complete before moving onto next task (as is the normal ansible playbook operation). Is there any way to do this

[ansible-project] How to display verbose only for a particular task in playbook?

2021-06-01 Thread Vikram S
I have several tasks in a playbook. I want to see - (highest verbose level) only for a single task in the playbook. So i don't want to give - after 'ansible-playbook sample.yaml'. Is there any way to display - info only for a single task while running the playbook? Thanks,

Re: [ansible-project] Need assistance to write script for verifying EIGRP neigbourship in routers

2021-05-28 Thread Vikram S
nt as zero. Any idea why this difference happens? Thanks, Vikram On Friday, 28 May, 2021 at 5:19:48 pm UTC+5:30 dick@geant.org wrote: > Count > > On Fri, 28 May 2021 at 10:08, Vikram S wrote: > >> Hi, >> >> I am wondering what module/ filter to use fo

Re: [ansible-project] Need assistance to write script for verifying EIGRP neigbourship in routers

2021-05-28 Thread Vikram S
021 at 23:39, Vikram S wrote: > >> Hi Dick, >> >> Sorry i didn't frame my question properly. What i want to check is the >> number of entries in the output matches with the entries after IOS upgrade >> & reload. >> I wrote the below script but i don't think

Re: [ansible-project] Need assistance to write script for verifying EIGRP neigbourship in routers

2021-05-27 Thread Vikram S
just need to compare some output before and after the > upgrade so you can tell if they're equal. > > > On Thu, 27 May 2021 at 18:56, Vikram S wrote: > >> I request assistance to write a script that needs to verify that EIGRP >> neighbourship shown in router before

[ansible-project] Need assistance to write script for verifying EIGRP neigbourship in routers

2021-05-27 Thread Vikram S
I request assistance to write a script that needs to verify that EIGRP neighbourship shown in router before IOS upgrade is the same after IOS upgrade (and reload) as well. Below is a sample output of EIGRP neibourship that i need to verify after IOS upgrade. How can i write a script for that?

Re: [ansible-project] Need assistance to check if config is present in certain order in router

2021-05-19 Thread Vikram S
uot; Thanks, Vikram On Tuesday, 18 May, 2021 at 10:02:07 pm UTC+5:30 dick@geant.org wrote: > Yes this is possible but having the regex multiline aware > > On Tue, 18 May 2021 at 15:36, Vikram S wrote: > >> >> Hi Dick, >> >> Not sure if i misunderstood y

Re: [ansible-project] Need assistance to check if config is present in certain order in router

2021-05-18 Thread Vikram S
gt; https://docs.ansible.com/ansible/latest/user_guide/playbooks_filters.html#id40 > > > On Tue, 18 May 2021 at 04:59, Vikram S wrote: > >> The output of 'sh run | i boot' shows 2 boot statements set in router. >> But i need to write a script which will check if >>

[ansible-project] Need assistance to check if config is present in certain order in router

2021-05-17 Thread Vikram S
The output of 'sh run | i boot' shows 2 boot statements set in router. But i need to write a script which will check if '9.16.12.04.SPA.bin' is present specifically in 1st line followed by '...9.16.06.04.SPA.bin' specifically in 2nd line. I know to write a script to check if both

[ansible-project] Request assistance to extract partial output using RegEx

2021-05-17 Thread Vikram S
When i give 'sh version | i System image' in cisco router, it shows me below output. How do i extract only the image name - 'isr4300-universalk9.16.12.01.SPA.bin' from below output? ROUTER#sh version | i System image System image file is "bootflash:isr4300-universalk9.16.12.01.SPA.bin" I

[ansible-project] Request assistance to extract partial output using RegEx

2021-05-17 Thread Vikram S
When i give 'sh version | i System image' in cisco router, it shows me below output. How do i extract only the image name - 'isr4300-universalk9.16.12.01.SPA.bin' from below output? ROUTER#sh version | i System image System image file is "bootflash:isr4300-universalk9.16.12.01.SPA.bin" I

[ansible-project] Re: How do i use regex_findall filter to display partial output of 'sh clock' command?

2021-05-15 Thread Vikram S
stdout[0] | > regex_findall('[A-Z][a-z]{2}\s[0-9]{2}\s[0-9]{4}')" should work although I > am no expert so there may be a better way to do it. > I found https://regexone.com/ to be helpful to learn the basics and > https://regex101.com/ for testing. > > On Monday, May 10, 2021 at

[ansible-project] How do i use regex_findall filter to display partial output of 'sh clock' command?

2021-05-10 Thread Vikram S
In below output, i want only the 'May 11 2021' to be displayed on screen. *Switch#sh clock* *02:42:19.622 Sng Tue May 11 2021* Below is a sample script and used 'regex' filter as an example. How do i modify the script/ incorporate other any other filter such that my above objective is achieved?

[ansible-project] Using stdout[0] in below script changes the output a lot. Trying to understand why?

2021-05-10 Thread Vikram S
My question on stdout[0] is specific to below output. As i understand from ansible documentation, stdout means that it quotes the output of a variable and [0] means referencing the first char or command. I am just trying to figure out how the definition relates to what it does in below

[ansible-project] Need clarification for 'prompt' parameter of ios_command module

2021-05-10 Thread Vikram S
I need clarification when using 'prompt' parameter of ios_command module with regards to below command. Below is the sample script to copy ios image. Please look at line with 'prompt' command - i need to give the command with 2 forward slash at start and end (\iosfilename.bin). Only then it

Re: [ansible-project] How do i compare the parsed output against a value?

2021-04-21 Thread Vikram S
ke: > > when: show_flash.bandwidth|int >= 5 > > > On Wed, 21 Apr 2021 at 20:30, Vikram S wrote: > > > > Hi, > > > > I used TTP parser to parse the output of 'sh run int gi0/0' and below is > output. > > > > Say for example, i want to compare

[ansible-project] How do i compare the parsed output against a value?

2021-04-21 Thread Vikram S
Hi, I used TTP parser to parse the output of 'sh run int gi0/0' and below is output. Say for example, i want to compare bandwidth value againt a number and check if it higher/lower than a certain value, how do i write the syntax for that? TASK [Display facts] ok: [ROUTER] => { "msg": [

Re: [ansible-project] TTP parsing doesn't work in ansible, need assistance

2021-04-21 Thread Vikram S
: parser_output Thanks, Vikram On Wednesday, 21 April, 2021 at 5:00:00 pm UTC+5:30 rajthecomputerguy wrote: > try removing quotes in stdout > > > > On Wed, Apr 21, 2021 at 3:34 PM Vikram S wrote: > >> >> I wrote below script to parse output of 'sh flash:' how

[ansible-project] TTP parsing doesn't work in ansible, need assistance

2021-04-21 Thread Vikram S
I wrote below script to parse output of 'sh flash:' however iam getting blank output. I checked several examples and i seem to be following the format properly yet doesn't work. What am i doing wrong? *SCRIPT:* ios_command: commands: "show flash:" register: show_space name: Pass text and

Re: [ansible-project] need assistance in using regex filter to extract a data

2021-04-20 Thread Vikram S
understand these parameters? Once again, many thanks Racke. You have been consistently helping with so many of my queries! Vikram On Tuesday, 20 April, 2021 at 7:50:56 pm UTC+5:30 brae...@gmail.com wrote: > On 4/20/21 3:07 PM, Vikram S wrote: > > Hi Racke, > > > > Thanks for the

Re: [ansible-project] need assistance in using regex filter to extract a data

2021-04-20 Thread Vikram S
> > * > > * > > Thanks, > > Vikram > > Hello Vikram, > > this should help you to get the second number from your string: > > - debug: > msg: "{{ diskspace_string | regex_findall('\\d+') | last }}" > vars: > diskspace_string: '122185728 bytes tot

Re: [ansible-project] need assistance in using regex filter to extract a data

2021-04-20 Thread Vikram S
total (9308672 bytes free)* Thanks, Vikram On Tuesday, 20 April, 2021 at 5:27:11 pm UTC+5:30 brae...@gmail.com wrote: > On 4/20/21 12:17 PM, Vikram S wrote: > > Hi, > > > > I went through ansible documentation for regex filter and it's various > example. But please e

Re: [ansible-project] need assistance in using regex filter to extract a data

2021-04-20 Thread Vikram S
)* Thanks, Vikram On Tuesday, 20 April, 2021 at 5:27:11 pm UTC+5:30 brae...@gmail.com wrote: > On 4/20/21 12:17 PM, Vikram S wrote: > > Hi, > > > > I went through ansible documentation for regex filter and it's various > example. But please excuse my incomprehension, >

[ansible-project] need assistance in using regex filter to extract a data

2021-04-20 Thread Vikram S
Hi, I went through ansible documentation for regex filter and it's various example. But please excuse my incomprehension, iam stuck on using regex to extract the integers. Below is the output on which i want to use regex. I want to filter out only '48700416' and leave out everything else and

[ansible-project] Getting error when using native and XML parser, how to solve this?

2021-04-18 Thread Vikram S
Hi, I installed ansible.utils ansible colelctions and used native parser and XML parser (as Pyats genie parser did not work for a command i need to parse). But iam getting below error and not sure why it happens expecially when iam following the syntax as given in documentation. Any

[ansible-project] Need a parser that will help me compare free space of member switches

2021-04-18 Thread Vikram S
In a stacked switch, 'ansible_net_filesystems_info' of ios_facts module only shows free space of master switch. It doesn't show space of member switches. But I need to write a script that will check for certain amt of free space in EVERY member switch before copying ios image. I thought of

[ansible-project] Getting error - "parse_genie: Genie package is not installed. To install, run 'pip install genie'."

2021-04-18 Thread Vikram S
Hi, I am getting an error when i run playbook for parsing using genie (pyats) - "parse_genie: Genie package is not installed. To install, run 'pip install genie'." 1. However i have already installed pyats and genie. 2. I use WSL linux in windows VDI and use debian linux 10 (since some

[ansible-project] Getting error when i try to use Pyats parser

2021-04-17 Thread Vikram S
Hi, I installed pyats parser (got a minor error but installation was completed). Then i ran below 2 scripts but getting error. 1st script was run as per example in ansible documentation for ansible.netcommon.cli_parse. I have ansible 2.9 and when i select that version in above

[ansible-project] Re: Need assistance in using 'OR' condition with regex_findall

2021-04-11 Thread Vikram S
+5:30 Vikram S wrote: > Hi, > > Below condition in statement 1 and 2 checks the number of boot statement > set in switch matches with number of member switches available to ensure > that correct boot statement is set for every member switch. Both statement > 1 and 2 wor

Re: [ansible-project] When conditional does not work with ios_config module, please help

2021-04-11 Thread Vikram S
uot; Thanks, Vikram On Sunday, 11 April, 2021 at 7:03:17 pm UTC+5:30 brae...@gmail.com wrote: > On 4/11/21 3:25 PM, Vikram S wrote: > > Hi, > > > > I have written the below script to check if packages.conf has been > updated (by checking it's date) in flash and if so

[ansible-project] Need assistance in using 'OR' condition with regex_findall

2021-04-11 Thread Vikram S
Hi, Below condition in statement 1 and 2 checks the number of boot statement set in switch matches with number of member switches available to ensure that correct boot statement is set for every member switch. Both statement 1 and 2 work when i give them individually. But they fail when i use

[ansible-project] When conditional does not work with ios_config module, please help

2021-04-11 Thread Vikram S
Hi, I have written the below script to check if packages.conf has been updated (by checking it's date) in flash and if so, to set it as boot statement for switch. But ansible does not seem to consider the when conditional at all. It sets the boot statement regardless of whether the condition

[ansible-project] regex_findall doesn't work for me. What am i doing wrong?

2021-04-09 Thread Vikram S
Hi, I wrote a script to check if particular IOS version is set as boot statement. But it doesn't work. What am i doing wrong? name: Gather show boot ios_command: commands: "show boot" register: show_boot debug: msg: "{{ 'show_boot.stdout' |

[ansible-project] Need assistance to run tasks/module on several switch simultaneously (my script currently checks 1 device at a time)

2021-03-30 Thread Vikram S
Below is the script i have written to perform MD5 verification for stacked switch 2. Problem with this script is that iam saving output of MD5 verification command to a custom varriable called 'md5_flash2' using register and then checking if correct md5 value is present there. Since iam

Re: [ansible-project] Ansible shows error that says missing ':' even when it is already present

2021-03-29 Thread Vikram S
erhaps be, that you forgot a "-" at the before "register"? > Am 26.03.21 um 14:13 schrieb Vikram S: > > Please look at the screenshot in below link. Ansible shows an error that > 'could not find expected :'. However as shown in the screenshot, the palce > where

[ansible-project] Need clarification on the max routers to which ansible can copy image simultaneously?

2021-03-29 Thread Vikram S
I read that by default, for each task, Ansible will fork five parallel threads (called forks) and execute these threads in parallel across five nodes in the inventory. Once these tasks finish, it will target the remaining devices in the inventory in a batch of five nodes. 1. Does

[ansible-project] Ansible shows error that says missing ':' even when it is already present

2021-03-26 Thread Vikram S
Please look at the screenshot in below link. Ansible shows an error that 'could not find expected :'. However as shown in the screenshot, the palce where it indicates an error, that palce already has the ':'. Why does ansible show this?

[ansible-project] Why is ansible so buggy?

2021-03-25 Thread Vikram S
Ansible sometimes behaves differently when i execute the same script multiple times. Examples: 1. Once, name for TASKS were not shown when script was run 1st time. Name was shown the 2nd time. 2. It showed command timeoput of 10 secs reached and script failed but same script executed earlier

[ansible-project] How to write script for multiple prompts?

2021-03-24 Thread Vikram S
Hi, Below is the command i need executed as part of IOS upgrade activiity. As you can see, it involves 2 prompts. So how do i write a script using ios_command module when multiple prompts are involved? install add file flash:cat9k_lite_iosxe.16.12.01.SPA.bin activate commit This operation

Re: [ansible-project] Playbook output is not saved properly in file, please guide

2021-03-23 Thread Vikram S
0 15169 3994770 3430527 1579942429 > 0023w2d985\n82.148.106.13 0 16509 3955040 3453340 > 157994242900 3w0d 1405\n82.148 > > _________ >

Re: [ansible-project] When conditional not working when i use 'OR' for multiple confitions

2021-03-21 Thread Vikram S
h were > used in rds database in aws cloud. > > Thanks & regards, > > > On Fri, Mar 19, 2021 at 4:24 PM Vikram S wrote: > >> I have wrriten below script to check if switch is in state mentioned in >> WHEN condition and to end playbook if so. But

Re: [ansible-project] How to verify boot statement for ALL member switches in stacked switch?

2021-03-21 Thread Vikram S
e in the stack > > ansible_net_stacked_serialnums > list / elements=string > when multiple devices are configured in a stack > The serial numbers of each device in the stack > > > On Fri, Mar 5, 2021, 8:09 PM Vikram S wrote: > >> Hi Pushparaj, >> >> Thanks for

Re: [ansible-project] When conditional not working when i use 'OR' for multiple confitions

2021-03-19 Thread Vikram S
, then playbook has to end. Regards, Vikram On Friday, 19 March, 2021 at 11:08:12 pm UTC+5:30 Antony Stone wrote: > On Friday 19 March 2021 at 17:56:38, Vikram S wrote: > > > Hi Antony, > > > > Yes, i want to end the playbook if every member switch in a stack is in &g

Re: [ansible-project] When conditional not working when i use 'OR' for multiple confitions

2021-03-19 Thread Vikram S
at 4:27:41 pm UTC+5:30 Antony Stone wrote: > On Friday 19 March 2021 at 11:53:59, Vikram S wrote: > > > - name: END THIS PLAYBOOK IF ALL MEMBER SWITCHES ARE NOT IN READY STATE > > I find this ambiguous. > > Does it mean that you want to end the playbook if every switch i

[ansible-project] When conditional not working when i use 'OR' for multiple confitions

2021-03-19 Thread Vikram S
I have wrriten below script to check if switch is in state mentioned in WHEN condition and to end playbook if so. But when condition doesn't work when i use 'OR' conditional to check for multiple conditions. I tried different ways of writing the OR syntax as given below but didn't work. What

Re: [ansible-project] How do i export the ansible output of a playbook TASK to a excel sheet or table?

2021-03-18 Thread Vikram S
ate and render the variable values and get a html > table output. > > On Mon, Mar 15, 2021 at 12:18 PM Vikram S wrote: > >> I am writing a script for IOS upgrade in switches and script involves >> multiple TASKS like checking copying image, settings boot statement, etc. >>

Re: [ansible-project] How do i export the ansible output of a playbook TASK to a excel sheet or table?

2021-03-18 Thread Vikram S
gt; > > On Mon, Mar 15, 2021 at 12:30 PM Rajthecomputerguy > wrote: > >> write a Jinja2 template and render the variable values and get a html >> table output. >> >> On Mon, Mar 15, 2021 at 12:18 PM Vikram S wrote: >> >>> I am writing a script f

[ansible-project] How do i export the ansible output of a playbook TASK to a excel sheet or table?

2021-03-15 Thread Vikram S
I am writing a script for IOS upgrade in switches and script involves multiple TASKS like checking copying image, settings boot statement, etc. The final task would be to check if IOS upgrade was successful or not and display it on screen. Mgmt wants only the output message for the final

[ansible-project] How do i export the ansible output of a playbook TASK to a excel sheet or table?

2021-03-15 Thread Vikram S
Hi, I am writing a script for IOS upgrade in switches and script involves multiple TASKS like checking free space, copying image, settings boot statement, etc. The final task would be to check if IOS upgrade was successful or not and display it on screen. Mgmt wants the output shown by

[ansible-project] Need assistance to write script to find free space in all member switches (not just master switch)

2021-03-11 Thread Vikram S
Problem: In a stacked switch, 'ansible_net_filesystems_info' of ios_facts module only shows total and free space of master switch. It doesn't show space of member switch. But I need to write a script that will check for certain amount of free space in EVERY member switch before copying ios

[ansible-project] ios_facts doesn't return output when used in playbook but shows output in ad-hoc command. Why?

2021-03-09 Thread Vikram S
Below is my playbook to gather ios_facts info in GNS3 router. The output shows "VARIABLE IS NOT DEFINED!" But when i gather ios_facts using ad-hoc command, it works. Why the difference? name: PLAYBOOK 1

[ansible-project] Ansible showing incorrect info when i try to find free space in switch, please help

2021-03-06 Thread Vikram S
I have written a script to check for free space in switch before i proceed to copy image. I used ios_facts module and i used below return values however the free and total space displayed is incorrect than the actual free/total space i saw in switch. Why is this happening? Incorrect value

[ansible-project] How to stop checking for further TASKS if a condition is not met?

2021-03-05 Thread Vikram S
Iam writing a script to upgrade IOS image in several switches. I have several TASKS written which would be checked in sequential order. I wish to add a condition that if a particular TASK/condition were to fail, then playbook should stop processing further TASKS for this device and move onto

Re: [ansible-project] How to verify boot statement for ALL member switches in stacked switch?

2021-03-05 Thread Vikram S
+5:30 rajthecomputerguy wrote: > you can use regex to match and pipe length -- that should be equal to 3 > > regex_findall("flash:/c2960x-universalk9-mz.152-4.E7/c2960x-universalk9-mz.154-4.E4.bin") > > | length > > > > On Thu, Mar 4, 2021 at 3:24 AM V

[ansible-project] Need clarification regarding ios_facts module

2021-03-04 Thread Vikram S
I usually use below script to check free space before proceeding to copy image. But when i need to copy image to a stacked switch, will this command show free space in ALL member switches or will it show only master switch free space? I don't have a stacked switch to test. So need your

[ansible-project] How to verify boot statement for ALL member switches in stacked switch?

2021-03-03 Thread Vikram S
When i use below command, it automatically copies image to ALL member switches and sets boot statement by itself. archive download-sw /leave-old-sw ftp://username:password@10.4.1.104 /c2960x-universalk9-tar.154-4.E4.tar I need to write a script to verify that boot statement is automatically

[ansible-project] How to make ansible check for free space in EVERY member switches of a stack switch?

2021-03-03 Thread Vikram S
Below is the config i use for checking if router flash memory has certain amount of free space and then copy IOS image to it if it has. Now i need to do the same thing for stacked switch. But iam wondering if below config will be sufficient for checking free space in EVERY member switch

[ansible-project] Does IOS network module work for IOS-XE models as well?

2021-03-03 Thread Vikram S
Will IOS network module work only for IOS OS running devices or will it work for IOS-XE OS devices as well? Reason iam asking is because i see separate modules for IOS, NX-OS and IOS-XR but nothing for IOS-XE. So i want to make sure IOS module applies for both IOS nad IOS-XE. This might

[ansible-project] Clarifications needed for 'prompt' parameter of ios_command module

2021-03-02 Thread Vikram S
When i use 'prompt' parameter of ios_command module for IOS image copying as in Example 1, it fails. But it succeeds as in Example 2. I want to understand why? I am trying to understand why this below syntax works? Destination filename \[ image name\]?' This issue happens only for IOS copying

Re: [ansible-project] How do i do IOS upgrade of devices sequentially and not simultaneously?

2021-03-01 Thread Vikram S
nsible/latest/user_guide/playbooks_strategies.html#setting-the-batch-size-with-serial > > > On Sun, 28 Feb 2021 at 20:35, Vikram S wrote: > >> I have written a script to do IOS upgrade of cisco devices. However >> problem is that each TASK in playbook gets executed SIMULTANEOU

[ansible-project] Will IOS module apply for ASA as well?

2021-02-28 Thread Vikram S
I notice that ASA has 4 modules listed in ansible documentation. But i was wondering if i can use IOS modules with ASA as well? I had this doubt as ASA also uses IOS OS and IOS modules offer lot more options and flexibility. Thanks, Vikram -- You received this message because you are

[ansible-project] How do i do IOS upgrade of devices sequentially and not simultaneously?

2021-02-28 Thread Vikram S
I have written a script to do IOS upgrade of cisco devices. However problem is that each TASK in playbook gets executed SIMULTANEOUSLY on all devices defined in inventory file before moving on to next TASK. But my requirement is: 1. I want to complete IOS upgrade of 1 device first and only

Re: [ansible-project] Re: wait_for module doesn't work as expected with router

2021-02-22 Thread Vikram S
gt; https://docs.ansible.com/ansible/latest/collections/ansible/builtin/wait_for_module.html#examples > ? > Check if that is your problem. > > > On Mon, 22 Feb 2021 at 16:53, Vikram S wrote: > > > > Hi, > > > > The issue is that device is online and reachable eve

[ansible-project] Re: wait_for module doesn't work as expected with router

2021-02-22 Thread Vikram S
@gmail.com wrote: > wait_for have timeout, by default 300s. > > wait_for: > timeout: 800 > > On Saturday, February 20, 2021 at 3:57:18 PM UTC+1 Vikram S wrote: > >> Hi, >> >> I am writing a script to upgrade IOS in cisco router. After i give reload &

  1   2   >