Note: Please go to docs.rightscale.com to access the current RightScale documentation set. Also, feel free to Chat with us!
Home > Guides > Dashboard Users Guide > Manage > Deployments > Servers > Actions > Run 'Any Script' on a Server(s)

Run 'Any Script' on a Server(s)

Objective

To use the 'Any Script' option to run a single RightScript on one or more Servers

Table of Contents

Prerequisites

  • 'actor' user role privileges

Overview

When a Server is running, you can run any of its scripts on-demand at anytime under the Scripts tab.  A Server is designed to inherit its scripts from its ServerTemplate.  Typically, the ServerTemplate will contain any relevant RightScripts for a particular server.  However, you may need to run a script to perform a one-time upgrade to a running server or apply a patch across a set of servers.  In such cases, instead of adding the script to the Server's ServerTemplate (which may not be possible if you launched the Server with a committed ServerTemplate) just so that you can perform a one-time operation, you can use the 'Any Script' option.  The 'Any Script' option is useful if you need to execute a script that wasn't inherited by the ServerTemplate. For example, you might want to run a script from one of the 'Toolbox' ServerTemplates.

Steps

The 'Any Script' option is only available for use on running servers.  Although an 'Any Script' can be used at multiple levels, the operation functions slightly different depending on where it's executed.  The 'Any Script' option can be found under the Scripts tab at the following levels:

  • Server
  • Deployment
  • Server Array

 

Select an 'Any Script'

Go to the Scripts tab at the level where you're going to run the 'Any Script' and click on the dropdown bar to open a selection window where you can select which RightScript you want to execute.  Note: You can only use the 'Any Script' option to run a RightScript.  It cannot be used to run a Chef Recipe.

screen-AnyScriptSelect-v1.png

Select the revision of the script you want to run and click the Run button.

Select which Servers the Script should be run on

Unless you are running the 'Any Script' at the Server level, you will be prompted to select which active Servers the script should be run on.  (You cannot run an 'Any Script' on an inactive Server.) 

Deployment Level

There is an intermediary page where you can filter by one of the following prior to making the selection of what Servers to run the selected RightScript against

  • Server's Nickname
  • ServerTemplate
  • Machine tags

Based on the result set of the filters you choose you can also select "all shown", "none" or "all Number#"  (where Number# is the total number of Servers in the result set.  This is only displayed if pagination is involved in the Servers result set).  Notice this feature can be very helpful in the event you need to patch all (or most all) Servers in your Deployment.  For example, perhaps you have a change to make to the /etc/bashrc (or similar startup file) on 10 Servers in a Deployment, that use 3 or 4 different ServerTemplates.  You could write a one-off RightScript to make the change, and run it as an 'Any script' against all the Servers in your Deployment.  (There is no need to add the RightScript as an Operational script to each ServerTemplate, etc.)

screen-AnyScriptDeployment-v1.png

Make your selection(s) and click the Run on selected action button when ready. 

Note:  When you run an 'Any Script' at the Deployment level, the script will not be run on any instances in a Server Array that's attached to the Deployment.  To run the script across all instances in an array, you will need to perform the 'Any Script' operation at the Server Array level.

Server Array Level

When you run an 'Any Script' at the Server Array level, the script will be run on all selected instances.  Typically, each instance in the server array will be launched with the same ServerTemplate.  However, if there are instances that were launched with different ServerTemplates, they will be listed separately.  You can only run the script across all instances that were launched with a particular ServerTemplate.  You cannot select instances individually.  (If you want to run the script only on certain instances, you can do so at the individual Server level.)

  • Run on oldest - Only run the script on the oldest instance of a ServerTemplate group.  The "oldest" instance is the one with the longest runtime.  For example, you may want to run the script on the oldest server before you run it on the rest of the servers.
  • Run on all - Run script on all selected ServerTemplate groups.
     

screen-AnyScriptArray-v1.png

Select which action you wish to run.

Specify Input Parameters

Next, you will need to specify any missing input parameters.  

screen-AnyScriptInput-v1.png

If you are running the 'Any Script' at either the Server or Server Array levels, input inheritance rules will apply, so the input parameters will be prepopulated if any of the script's inputs have been predefined at either the ServerTemplate, Deployment, or Server / Server Array levels.  

However, if you are running the 'Any Script' at the Deployment level, input parameters will not be prepopulated.  You will need to manually enter all input parameters.  If you want to use the same value for an input that's been predefined at a different level, you will need to use the Inputs tab as a cross-reference.

Once all input parameters have been defined, click Run to actually run the script on the server(s).

You must to post a comment.
Last modified
08:53, 19 Sep 2014

Tags

Classifications

This page has no classifications.

Announcements

None


© 2006-2014 RightScale, Inc. All rights reserved.
RightScale is a registered trademark of RightScale, Inc. All other products and services may be trademarks or servicemarks of their respective owners.