Reply

Looking for help using data from running config to add an additional line.

Techie
Posts: 3
2647     0

Hello,

I'm in the process of moving our ASAs from an IPSec tunnel to EZVPN. I've got a CCS script that pulls the hostname and works for one Trigger but it creates a second  Trigger writing the wrong information over the correct one. There is a large number of devices that need to be changed with unique usernames.

SCRIPT:

 

Script-Filter:
$Vendor eq "Cisco"
 
#########################################################################
Action:
Show Running Config
 
Action-Description:
This action executes the "show running-config" command to
retrieve the running configuration. 
 
Action-Commands:
show running-config
 
Output-Triggers:
Create User Password Line
 
#########################################################################
Trigger:
Create User Password Line
 
Trigger-Description:
Creates unique vpnclient username and standard password pulled from hostname in running config.
 
Trigger-Variables:
$EZname /[^\r\n]+/
 
Trigger-Template:
hostname [[$EZname]]
 
Trigger-Commands:
config terminal
 
vpnclient username $EZname password XXXXX
 
exit
write memory
#########################################################################
 
OUTPUT:
1. Action: 'Show Running Config'
12:21:46 Action-Commands
12:21:46 show running-config
 
 
1.1. Trigger: 'Create User Password Line' Output: 'Show Running Config'
12:21:48 Trigger-Template
12:21:48 Template matches
12:21:48  
hostname (CO-7003)
12:21:48 Trigger-Variables
12:21:48 $ezname = 'CO-7003'
12:21:48 Trigger-Commands
12:21:48 config terminal
12:21:49 vpnclient username CO-7003 password XXXXX
12:21:49 exit
12:21:49 write memory
  <script></script>
 
1.2. Trigger: 'Create User Password Line' Output: 'Show Running Config'
12:21:51 Trigger-Template
12:21:51 Template matches
12:21:51  
hostname (context )
12:21:51 Trigger-Variables
12:21:51 $ezname = 'context '
12:21:51 Trigger-Commands
12:21:51 config terminal
12:21:51 vpnclient username context password XXXXX
12:21:51 exit
12:21:51 write memory
 
Could anyone help me kill the Trigger 1.2 that changes the hostname to "context"?
 
Thanks,
Fred

Re: Looking for help using

Adviser
Posts: 452
2647     0

Try this :

 

Trigger-Variables:
$EZname /\w+/
 
Let me know if that works for you
 
Sif
Follow me on LinkedIn: https://www.linkedin.com/in/sifbaksh
Twitter: https://twitter.com/sifbaksh

https://sifbaksh.com

Re: Looking for help using

Techie
Posts: 3
2647     0

Thank you very much for the response. After changing the Trigger-Variables it still had the same result where it replaced the $EZname with "context" on a second run.

I did make some progress by adding a second "exit" line at the end of the script. The only downside with that is it reports as an error but I am pretty sure I can live with that by creating a group that doesn't include the new line and re-run the script on those devices.

Thank you again for your help. It's great to know now that I can get different outputs from the running config. That will help in the rest of the lines I need added!

Fred

Re: Looking for help using

Adviser
Posts: 452
2647     0

Would you mind adding the all.zip file for the job that your running.

If you do, then post the show command so I can create the RegEX statement for you

Follow me on LinkedIn: https://www.linkedin.com/in/sifbaksh
Twitter: https://twitter.com/sifbaksh

https://sifbaksh.com

Re: Looking for help using

Authority
Posts: 39
2647     0

Could it be that your running config has hostname on two lines?

I suggest adding a flag to only allow the hostname to be changed once.

 

Re: Looking for help using

Techie
Posts: 3
2647     0

The flag worked great. Thank you so much!

Showing results for 
Search instead for 
Did you mean: 

Recommended for You