I attempted to write a config template script to change local accounts on juniper devices, yet cannot get the script to work all the way through.
I believe the template needs to include interacting with the Juniper terminal in a way that allows the CLI commands I have written in the script, to work.
Anyone good at Juniper scripts for Change Config Templates in NCM?
Cheers!
Kimberly
Here is the script I have so far that logs onto the device, yet doesn't make the changes I'm trying to make, it exits with space errors
/*
.CHANGE_TEMPLATE_DESCRIPTION
This will change the default local account and password in the event taCACS is down and we need to login to the device locally. Kim Viik and Robert Logan 12/12/2014
.CHANGE_TEMPLATE_TAGS
SRX, JUNOS, JUNIPER, Password_Change
.PLATFORM_DESCRIPTION
Juniper Devices.
.PARAMETER_DESCRIPTION @ContextNode
The node the template will operate on. All templates require this by default. The target node is selected during the first part of the wizard so it will not be available for selection when defining values of variables.
.PARAMETER_LABEL @NewPassword
The new enable password.
.PARAMETER_DESCRIPTION @NewPassword
This should be a valid Juniper Junos password.No spaces are allowed, a script will not be generated for a password including a space.
*/
script ChangePassword (
NCM.Nodes @ContextNode,
string @NewPassword )
{
if (@NewPassword contains ' ')
{}
else
{
foreach ( @node in @ContextNode )
{
{
CLI
{
Configure
set system login user neteng authentication plain-text-password
@NewPassword
@NewPassword
set system login user 5upp0rt authentication plain-text-password
@NewPassword
@NewPassword
commit and-quit
exit
}
}
}
}
}