Zero Touch Provisioning (ZTP) using USB

Zero Touch Provisioning (ZTP) using USB

Description:

     Zero Touch Provisioning using the USB drive is a process that allows the self provisioning to be automated with files created in the USB.  The ZTP will fully configured a Nodegrid to a functional states which allows users access to the device consoles connected to the Nodegrid appliance quickly.

Requirements:

      USB drive formatted file system as;
            FAT32 (VFAT), NTFS, EXT2, EXT3, EXT4
            *Note: Nodegrid CANNOT format a USB drive  as FAT32 or NTFS
      ZPE ZTP control file:
            Within the USB a directory "zpe-ztp" is mandatory and within the directory, all the files are needed are stored for the ZTP process.
            inside the "zpe-ztp" folder, usb-ztp.ctl or <nodegrid Serial Number>.ctl file is mandatory.  The ZTP process will first look for the serial number file then if it is not found then it will look for usb-ztp.ctl
            *Note: in this document, usb-ztp.ctl or the <serial number>.ctl is synonymous so usb-ztp.ctl is being referred to in this document.

 How it works:

      When the USB drive is inserted into the Nodegrid, it is automatically mounted.  if the "zpe-ztp" folder is present in the USB, the zpe-ztp process will run and look for the "<serial number>.ctl" if not found then it will look for "usb-ztp.ctl" for all the directives to be executed.  the "usb-ztp.ctl" name must match with case exactly.  Folders can be created within the zpe-ztp folder to better organized.  The file path in the USB can be relative or absolute within the zpe-ztp folder when defined in the CTL file.
usb-ztp.ctl examples:

The content of the CLI file that can executed example:


Create the USB Drive:

     Create a folder "zpe-ztp" directory in the USB drive and create the usb-ztp.ctl file in the "zpe-ztp" directory which contain directives of what will be done in the ZTP process.  These directives are dictionary defined "key value" steps. The keys can be used only one time in the CTL file because the files are copied to the Nodegrid.

      The predefined set of keys:

            zpe.ztp-signature             need to be set as "ZPE-USB-ZTP"

            zpe.ztp-image-filename   ISO files for Nodegrid upgrade or KVM device needed to created VM in Nodegrid

            zpe.ztp-script-filename   These can be Shell, python, Ansible scripts

            zpe.ztp-config-filename  The CLI file contained commands to setup the Nodegrid configuration

            zpe.ztp-confirm-md5      "yes" means that the md5 is used and if the md5 is the same then it will not do the upgrade for the config

                                                    "no" means that it does not check the md5 and will upgrade every time.

      Example of the usb-ztp.ctl recommended:
            zpe.ztp-signature ZPE-USB-ZTP                             # A signature string of the ZTP process
            zpe.ztp-image-filename img/Nodegrid-4-2.iso      # Nodegrid Version to be upgraded to
            zpe.ztp-script-filename src/zpe-script.sh                # Script to be executed in the Nodegrid appliance
            zpe.ztp-config-filename cli/Network/firewall.cli      # cli for setting up the Nodegrid internal firewall
            zpe.ztp-confirm-md5 no                                            # no md5 check needed

Debugging the ZTP Process:

      Before plugging in the USB drive into the Nodegrid:
            console connect to the Nodegrid.  Use the "shell sudo su -" to the root shell of the Nodegrid
            using the command:
                  lsblk - lists mount names and their mount point
                  df -Th - outputs the current list of mounted drives and the file type
                  mount - list mounted drives, mount points and permission
      Plug in the USB drive and issue the same command to get the name of the USB mounted drive
























Log data can be seen from the output log of the ZTP process.
"tail -f /var/ztp/usb_ztp.log" command will shows the ZTP execution process and when it is done.

attached is the zip file example for the process.
unzip the file into a usb drive.  make any changes to the cli script to have it work for your system.