2.4.2. Automated pre-configuration using Cloud-init

If you installed Turbo Router as a new Linux system, it includes a Day-1 configuration mechanism that starts a DHCP client on the first interface and enables a SSH server on it, so that the user can remotely access the console. This mechanism relies on cloud-init and can be customized as described in the following sections.

Cloud-init

Cloud-init is the defacto multi-distribution package that handles early initialization of a cloud instance. Using cloud-init, it is possible to preconfigure Turbo Router.

See also

For more information about Cloud-init, refer to https://cloudinit.readthedocs.io/en/latest/

Customizing the Turbo Router configuration files is possible only at first boot. The turbo service is started sooner in the next boots, before cloud-init.

Libvirt

The simpler way of using cloud-init with libvirt is to create an iso file labelled cidata.

  1. Write a user-data file and a meta-data file. In this example, we setup the root password and upload a license file.

    # cat << EOF > /tmp/user-data
    #cloud-config
    write_files:
     - path: /etc/turbo.lic
       content: |
         LICENSE 6wind turbo-router 01.99.99 permanent uncounted
           hostid=isv=628CE7A75DA9EFB7B3A2D3CDEB566889 customer=yourcompany
           _ck=c082fce984 sig="60PG4527MCR2KEKTD2UP7TRN18G1R6GDJCUM2XH508A03PHQ
    chpasswd:
      list: |
        root:myrootpassword
    EOF
    
    # cat << EOF > meta-data
    instance-id: turbo-vm
    local-hostname: turbo-vm
    EOF
    
  2. Build an iso image with the cidata label containing the user-data and meta-data and put it in the libvirt images directory.

    # apt-get install -y genisoimage
    # genisoimage -output seed.iso -volid cidata \
                             -joliet -rock user-data meta-data
    # cp seed.iso /var/lib/libvirt/images/
    
  3. Add seed.iso as a disk to the virt-install command. For instance, for a VM with virtual NICs.

    # virt-install --name vm1 --vcpus=3,sockets=1,cores=3,threads=1 \
                   --os-type linux --cpu host --network=default,model=e1000 \
                   --ram 6144 --noautoconsole --import \
                   --disk /var/lib/libvirt/images/vm1.qcow2,device=disk,bus=virtio \
                   --disk /var/lib/libvirt/images/seed.iso,device=disk,bus=virtio
    

OpenStack

Cloud-init is integrated within OpenStack.

  1. Write a cloud-init user-data file. In this example, we setup the root password and upload a license file.

    # cat << EOF > /tmp/user-data
    #cloud-config
    write_files:
     - path: /etc/turbo.lic
       content: |
         LICENSE 6wind turbo-router 01.99.99 permanent uncounted
           hostid=isv=628CE7A75DA9EFB7B3A2D3CDEB566889 customer=yourcompany
           _ck=c082fce984 sig="60PG4527MCR2KEKTD2UP7TRN18G1R6GDJCUM2XH508A03PHQ
    chpasswd:
      list: |
        root:myrootpassword
    EOF
    
  2. Start the VM with the additional parameter --user-data.

    # openstack server create --flavor turbo-router \
                              --image turbo-router \
                              --user-data /tmp/user-data \
                              turbo-router_vm
    

Examples

Here are a few user-data samples.

  1. Update the fast-path.env file that takes ens3 out of the fast path ports.

    #cloud-config
    write_files:
     - path: /etc/fast-path.env
       content: |
         FP_PORTS='all -ens3'
    

    Note

    As explained in the Customizing the fast path configuration section, the /etc/fast-path.env file is generated by the fast path configuration wizard. You can export this file out of the Turbo Router and put it in the cloud-init configuration as shown in this example.

  2. Upload the Turbo Router license file.

    #cloud-config
    write_files:
     - path: /etc/turbo.lic
       content: |
         LICENSE 6wind turbo-router 01.99.99 permanent uncounted
           hostid=isv=628CE7A75DA9EFB7B3A2D3CDEB566889 customer=yourcompany
           _ck=c082fce984 sig="60PG4527MCR2KEKTD2UP7TRN18G1R6GDJCUM2XH508A03PHQ