PackeTsar / freeztp

An Open-Source Zero-Touch Provisioning System for Cisco IOS.
GNU General Public License v3.0
214 stars 28 forks source link

Feature Request - PDB Location / Backup #85

Open pschapman opened 3 years ago

pschapman commented 3 years ago

Please add the following 2 knobs to ZTP configuration.

  1. PDB Location
  2. PDB Backup Location

Justification

Raspberry Pi and other "slow disk" platforms have shown problems with ZTP when the PDB file cannot be updated / accessed fast enough. To resolve this, the user can opt to place PDB file on a RAM-based virtual disk (tmpfs (modern) or ramfs (legacy)).

Implementation

Add the following 2 items to the ZTP configuration: ztp set pdb location <path spec> ztp set pdb backup <path spec>

Accomplish backups automatically by adding lines to the "Service" stanza in the service config file: ExecStart=/bin/bash -c 'cp <pdb backup path spec> <pdb loc path spec>' ExecStop=/bin/bash -c 'cp <pdb loc path spec> <pdb backup path spec>'

Known Risk

Power failure / system hang on ZTP host will result in loss of provisioning data since last backup. IMO, production use has shown little value in the provisioning data once successful deployment has occurred.

Example User Side Configuration

Set up tmpfs location and auto mount

$ sudo su
# mkdir /etc/ztp/pdbfs
# mount -t tmpfs -o size=64m pdbfs /etc/ztp/pdbfs
# nano /etc/fstab

Add the following line and save: pdbfs /etc/ztp/pdbfs tmpfs defaults,size=64M,x-gvfs-show 0 0

***Configure ZTP*** ``` # ztp set pdb location /etc/ztp/pdbfs # ztp set pdb backup /etc/ztp # ztp service restart ```