You can provide input parameters to the script as a simple key-value pair.

Script Properties

You can use scripts to configure any task. You can customize the host and the script details to any deployment requirement.

Table 1. Host and Script Details

Property

Description

Execute on Host

  • User defined hosts. You can enter one or more IP Addresses or DNS hostname or release pipeline variables as one of the valid hosts.

  • Host group variables. A variable represents a group of hosts.

  • Host group filter criteria: You can choose any host group and apply filter criteria to restrict the script to run only on selected hosts.

The property uses the following filter criteria.

  • ALL HOSTS. Run the script on all the hosts that the host group variable gives.

  • STARTS WITH. From the host group, filter machines whose names start with the prefix as given by the user. The filter search criteria is case sensitive.

  • ENDS WITH. Filter machines whose names end with the prefix as given by the user.

  • EXACT MATCH. Run the script only on the machine whose name exactly matches the DNS hostname or IP Address.

Host Username and Host Password

Used to make a remote connection to the host. All the hosts must have common credentials.

Execute Script File

Specify the script file name and the path that already resides on the host.

Script Type

The script task supports running a BASH or POWERSHELL script.

Script Input Parameters

The script task allows you to configure input parameters for a script as a simple key-value pair. The parameter name should exactly match the variable that is being used in the script. You can configure an artifact input parameter or a general input parameter to customize the script.

Artifact Input Parameter

These parameters are used to map artifacts to a script task, which enables the script to download artifacts from a repository to the host. The script calls the download URL or the repository URL for an artifact by mapping an artifact input property. For example, VCAC_APP_DOWNLOAD_URL.

To map the artifact input parameters, select Artifact Source, which is a variable that contains a group of artifacts. This variable is generated as part of output from the release pipeline artifact task.

Table 2. Parameters

Parameter

Description

Parameter Name

Name of the variable as referred to in the script.

Parameter Value

The artifact name in the parameter value must match the name specified in the artifact task.

General Input Parameter

You can configure other parameters that must be passed to the script as a simple key-value pair. For example, APPLICATION_PORT.

Sample Script

The following example shows a script that configures a vRealize Automation application.

$ cat configureAppServer.sh
echo "Configure app server";
echo "VCAC Application Download URL: $VCAC_APP_DOWNLOAD_URL";

wget -O VCAC_APP_DOWNLOAD_URL
echo "Configuring VCAC application";

echo "Starting application on port: $APLICATION_PORT";

MACHINE_IP = ifconfig | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.)(3)[0-9]*).*/\2/p'
printf "Application URL: $MACHINE_IP:$APPLICATION_PORT/vcac/" > $SCRIPT_RESPONSE_FILE

The script refers to the VCAC_APP_DOWNLOAD_URL environment variable to determine what version of the VCAC artifact to download from the repository. The artifact input parameter to the script should be the VCAC_APP_DOWNLOAD_URL parameter.

wget -O VCAC_APP_DOWNLOAD_URL
echo "Configuring VCAC application";

For the script to be able to share data with other release pipeline tasks, it must write the contents to a response file. The response file contents are stored in the script output variable.

MACHINE_IP = ifconfig | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p'
printf "Application URL: $MACHINE_IP/vcac/" > $SCRIPT_RESPONSE_FILE

Script Output

You can configure a script task output variable that is visible to other release pipeline tasks to consume the script response. This variable contains the runtime data, which was written to $SCRIPT_RESPONSE_FILE.

Script Logs

After the script runs, the EXECUTION_ID_FOLDER run folder is created in the <SCRIPT_NAME>_RUN folder . This folder contains the logFile, responseFile, exitStatusFile files, and a clone of the actual script that is being run. For example, script_params.txt, script_log.txt, script_response.txt.

The run folder is in the following locations.

Table 3. Run Folder Locations

Folder

Location

Bash script

/var/tmp/SCRIPT_NAME_RUN/EXECUTION_ID_FOLDER

Powershell Script

C:\Users\<USER_NAME>\AppData\Local\Temp\SCRIPT_NAME_RUN/EXECUTION_ID_FOLDER