To create a new RightScript.
RightScripts, along with the role they play in ServerTemplates are in many ways the heart of the RightScale Cloud Management Platform. Customers and Partners are free to use our RightScripts "as is", clone and customize existing RightScripts to suit their specific needs, or create new RightScripts from scratch. This tutorial shows you how to create a basic RightScript.
Go to Design > RightScripts and click New.
Provide the following information:
Name - A short nickname that helps you recognize the script.
Description - Describe the purpose of the script and any required inputs parameters that need to be defined. The description field is optional and does not affect the script's behavior.
Packages - A space-separated list of packages to install on the server. (ex: "mysql-server mysql-devel perl-DBD-MySQL mysqlclient14") At boot time, the package lists of all RightScripts attached to the server are linked together and installed in one invocation of the package manager (typically yum).
Inputs - A RightScript can be parameterized by specifying a number of inputs that need to be provided to the script for its operation. These inputs can come from a number of sources: user, server template, meta-data about the server or other servers, and the credentials attached to the account. The inputs are passed to the script as environment variables.
Identify - Click the Identify button to detect any environment variables that were declared in the Script field below. For Linux, all references of the form $ALL_CAPS are automatically identified as potential input parameters. For Windows, all references of the form $env:ALL_CAPS are automatically identified as potential input parameters.
Script - The script is typically a Bash, Perl, Ruby or Powershell script. It's best to keep the code short. Long and complex programs should be defined as an attachment and placed into a library. If the script starts with '#!' the named executable will be invoked (standard Unix convention). For Windows, Powershell will be used. In Linux, if no '#!' is provided, then "/bin/bash -e" is used. Note that scripts should signal a failure by using a non-zero exit code, which will stop the application and cause the server to be marked as "stranded" in the server state. Any subsequent scripts that are supposed to be executed after the current script (in the case of boot or decommission scripts) will not be executed so that an operator can take corrective action. Be sure to the check the server's audit entries to troubleshoot a script that failed to execute.