Apstra CLI Commands
SUMMARY A few examples of apstra-cli commands. The complete list is available in apstra-cli.
scenario change-device-password
To comply with security requirements and best practices you may need to change root
passwords and local user passwords on device system agents on a regular basis. Prior
to Apstra version 4.2.0 you had to run the command repeatedly, once for every device
that needed to be updated. The process has been streamlined starting with Apstra
version 4.2.0. You can now change passwords on all devices in a blueprint by running
a single command. Instead of entering a specific system ID you would enter
all
.
Use the following command to change all devices at once:
scenario change-device-password --blueprint <bp_id> --system all
--old-password <old_password> --new-password
<new_password>
Use the following command to change a specific device:
scenario change-device-password --blueprint <bp_id> --system
<sys_id> --old-password <old_password> --new-password
<new_password>
scenario change-device-password
is a collection of the following
eleven tasks:
-
Check old password by ssh connection
-
State creation of configlet for password
-
Commit blueprint
-
Check new password by ssh connection
-
Change system agent password
-
Check system agent status
- Update device pristine config
-
State deletion of configlet used for password change
-
Commit blueprint
-
Check new password by ssh connection
-
Check system agent status
scenario change-root-password (new in 4.2.1)
This command applies to Juniper, Arista and SONiC devices. Cisco devices are not supported. Use the following command to change all device root passwords at once:
scenario change-root-password --all --old-password <password>
--new-password <password>
Use the following command to change a specific device root password:
scenario change-root-password --system <system> --old-password
<password> --new-password <password>
config-syntax-check (Juniper only)
Command Syntax for Datacenter blueprints:
blueprint --blueprint <bp_id> config-syntax-check --system <sys_id>
--username <device_username> --password <device_password>
Command Syntax for Freeform blueprints:
blueprint --blueprint <bp_id> freeform-system config-syntax-check --system
<sys_id> --username <device_username> --password
<device_password>
With the config-syntax-check
command, you can verify configuration
syntax on your Juniper devices before committing your blueprint. This check is
useful when working with configlets in Datacenter blueprints and when working with
config templates in Freeform blueprints.
This command works only with hierarchical configuration to verify whether
configuration syntax is correct. It doesn't work for set
commands.