Script Playlists in CloudRay allow you to chain together multiple scripts, creating automated workflows that execute in a defined sequence. This feature is ideal for complex automation tasks where multiple steps need to be performed reliably and in order.

What are Script Playlists?

A Script Playlist is a collection of scripts that you arrange in a specific order. When a Runlog is created with a Script Playlist, CloudRay automatically executes the scripts one after another. Each script’s execution is dependent on the successful completion of the previous script.

Before creating a playlist, ensure you have scripts ready. Learn how to create and manage scripts in the Scripts docs.

With Script Playlists, you can:

  • Automate multi-step workflows with ease
  • Ensure sequential execution of scripts, where each script runs only after the previous one succeeds
  • Centralize management of complex automation tasks
  • Monitor progress through detailed Runlogs for each script in the playlist

Example Use Case: Deployment Workflow

Here’s an example of how you can use a Script Playlist to automate a deployment workflow:

  1. Step 1: Pull the latest code from the repository
  2. Step 2: Run database migrations
  3. Step 3: Deploy the application to the server
  4. Step 4: Run post-deployment tests

If any step fails, the playlist stops, allowing you to address the issue before proceeding.

To get started, create the scripts for each step in your workflow. Refer to the Scripts docs for guidance.

Creating Script Playlists

Follow these steps to create a new Script Playlist in CloudRay:

Screenshot of locating script playlists
  1. Navigate to “Script Playlists”: Click on the “Script Playlists” tab in the CloudRay interface
Screenshot of locating script playlists
  1. Click “New Playlist” at the upper left corner: Initiate the creation of a new playlist
Screenshot of sample script playlists
  1. Enter Details:

    • Playlist Name: Give your playlist a descriptive name (For example, “Deploy and Test Application”, “Weekly Server Maintenance”)
    • Steps:
      • Add Script: Click the ”+” button to add scripts to your playlist
  2. Save Script Playlist: Click “Create Playlist” to store your new playlist

Managing Script Playlists

CloudRay provides a simple and intuitive interface to manage your Script Playlists. You can view, edit, and delete playlists as needed.

Viewing Script Playlists

Screenshot showing script playlists

To check your available Script Playlists, simply click on the “Script Playlists” in the list. This will display the list of Scripts Playlists available in your account.

Editing Script Playlists

To modify an existing Script Playlist:

Screenshot showing script playlists
  1. Click the “Edit” button next to the playlist you want to update
  2. Make your changes, such as:
  • Adding or removing scripts
  • Reordering scripts in the playlist
  • Updating the playlist name
  1. Click “Save Script Playlist” to apply your changes

Deleting Script Playlists

To delete a Script Playlist:

Screenshot showing script playlists
  1. Click the “Delete” button next to the playlist you want to remove
  2. Confirm the deletion when prompted

How Script Playlists Work

  1. Create a Runlog: When creating a Runlog, select your Script Playlist along with the desired server and variable group (if applicable)
  2. Sequential Execution: CloudRay will start by executing the first script in the playlist
  3. Monitoring and Dependencies: The Runlog for the playlist will monitor the status of each individual script’s Runlog
    • Success: If a script completes successfully, CloudRay moves on to the next script in the playlist
    • Failure: If a script fails, the playlist execution stops, and the overall Runlog for the playlist is marked as failed

Best Practices for Using Script Playlists

  1. Error Handling: Ensure your individual scripts have robust error handling to prevent the entire playlist from failing prematurely
  2. Debugging: Use the Runlog for the playlist to track the progress of each script and troubleshoot any issues that arise
  3. Flexibility: Script Playlists can incorporate scripts of different types (Bash, Python, etc.) and utilise variable groups for dynamic configuration
  4. Reusability: Create modular scripts that can be reused across multiple playlists for different workflows