Create a StyleBook to upload files
Citrix ADM StyleBooks allow you to create Citrix ADC configurations that might include among other things while uploading files of any type from your local filesystem to the Citrix ADC instance, by using the Citrix ADM GUI or the APIs. These files can be the example certificate files or geolocation files. You can also specify the directory to upload these files.
The following is an example StyleBook that describes how to upload a geo-location file on the Citrix ADC instance. The geo files are used typically in GSLB configurations for defining static-proximity based on the geo location:
Build your StyleBook - 1
name: upload-geolocations namespace: com.citrix.adc.stylebooks.samples version: "1.0" display-name: GeoLocation File Upload description: This StyleBook is used to upload a geolocation file to Citrix ADC schema-version: "1.0" import-stylebooks: - namespace: netscaler.nitro.config version: "11.1" prefix: ns parameters: - name: locationfile label: Location File description: The system file path of the geolocation file on Citrix ADM type: file required: true components: - name: upload-file-comp type: ns::systemfile properties: filename: $parameters.locationfile.filename filelocation: "/var/netscaler/inbuilt_db/" filecontent: base64.encode($parameters.locationfile.contents) <!--NeedCopy-->
The parameter used in this example is of a type file. You can import this StyleBook in Citrix ADM and use it to upload geolocation files.
This StyleBook requires the file to be already present in Citrix ADM (for example, you would have already copied it to Citrix ADM using a utility like SCP). If you want to upload a file to Citrix ADCs through Citrix ADM without first copying it to the Citrix ADM filesystem, you can build a StyleBook that has two “string” parameters, one is for specifying the file name to be used on the Citrix ADC and the other to specify the contents of the file, and use these two parameters in the upload-file-comp components. The following is an alternative StyleBook to upload a geo-location file:
Build your StyleBook - 2
name: upload-geolocations-alt namespace: com.citrix.adc.stylebooks.samples version: "1.0" display-name: GeoLocation File Upload description: This StyleBook is used to upload a geolocation file to Citrix ADC schema-version: "1.0" import-stylebooks: - namespace: netscaler.nitro.config version: "11.1" prefix: ns parameters: - name: filename label: Location Filename description: The name of the location file on the Citrix ADC type: string required: true - name: filecontents label: Location File Contents description: The contents of the location file type: string required: true components: - name: upload-file-comp type: ns::systemfile properties: filename: $parameters.filename filelocation: "/var/Citrix ADC/inbuilt_db/" filecontent: base64.encode($parameters.filecontents) <!--NeedCopy-->
Creating configurations to upload files
The following procedure creates a configuration on a selected Citrix ADC instance that would upload a geolocation file using the first StyleBook described above.
To create a configuration for uploading files:
In Citrix ADM, navigate to Applications > Configuration, and click Create New. The Choose StyleBook page displays all the StyleBooks that are available in your Citrix ADM. Scroll down and select the StyleBook that you imported.
The StyleBook parameters appear as a user-interface page that allows you to enter the values for all the parameters defined in this StyleBook.
Enter the name of the load balancer and the virtual IP address in the basic load balancer settings section.
- In Location File section, enter the name or location of the file.
Ensure that in Citrix ADM, the file is located under the current tenant’s folder only. Use any FTP to copy the file to Citrix ADM file system.
You might be asked to provide your user credentials before you access the target instances.
- Select the target Citrix ADC instance on which the configuration needs to be created, and click Create.
Citrix recommends that you select Dry Run to check the configuration objects that are created on the target instance before you run the actual configuration on the instance.
When the creation of the configuration pack is successful, the file is saved on the Citrix ADC instance file system under the location: /var/netscaler/inbuilt_db/
You can also click the refresh icon to add recently discovered Citrix ADC instances in Citrix ADM to the available list of instances in this window.
Using the Citrix ADM API to create a configuration pack
You can also use the Citrix ADM API to create a configuration pack that uploads files to the selected Citrix ADC instance. For more information on how to use APIs, see How to Use API to Create Configurations to Upload Any File Type.