StackScripts provide Linode users with the ability to automate the deployment of custom systems. They work by running a custom script when deploying a new Compute Instance. These custom scripts store tasks that you may need to repeat often on new Compute Instances, such as:
Automating common system administration tasks, such as installing and configuring software, configuring system settings, adding limited user accounts, and more.
Running externally hosted deployment scripts.
Quickly creating Compute Instances for yourself or clients with the exact starter configuration you need.
All StackScripts are stored in the Linode Cloud Manager and can be accessed whenever you deploy a Compute Instance. A StackScript authored by you is an Account StackScript. A Community StackScript is a StackScript created by a Linode community member that has made their StackScript publicly available.
Get All
LinodeClient linodeClient =newLinodeClient("apikey");// Get AllList<StackScript> list =awaitlinodeClient.StackScript.Get();
Get One
Returns all of the information about a specified StackScript, including the contents of the script.
LinodeClient linodeClient =newLinodeClient("apikey");// Get OneStackScript stackScript =awaitlinodeClient.StackScript.Get(1278172);+
Create
Creates a StackScript in your Account.
LinodeClient linodeClient =newLinodeClient("apikey");// Labelstring label ="Super-StackScript";// ImagesList<string> listImages =newList<string> { "linode/debian10","linode/debian11","linode/debian12" };// Script. In this example we will update the system and install several packagesstring script ="#!/bin/bash\n"+"# Updates the packages\n"+"DEBIAN_FRONTEND=noninteractive apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y upgrade\n"+"# Tools\n"+"apt install curl -y\n"+"apt install wget -y\n"+"apt install unzip -y\n"+"apt install nginx -y\n"+"apt install nano -y";// Optional// Descriptionstring description ="This its an example";// revNotestring revNote ="check (LJChuello)";// Is Public; Default => falsebool isPublic =true;// Create StackScript StackScript stackScript =awaitlinodeClient.StackScript.Create( label, listImages, script, revNote: revNote, description: description, isPublic: isPublic);
Update
Updates a StackScript.
Once a StackScript is made public, it cannot be made private.
LinodeClient linodeClient =newLinodeClient("apikey");// Get StackScript stackScript =awaitlinodeClient.StackScript.Get(1300720);// Rename labelstackScript.Label="How to be an F1 driver for dummies (By; Valtteri Bottas)";// Set images, We add Ubuntu imagesstackScript.Images.Add("linode/ubuntu18.04");stackScript.Images.Add("linode/ubuntu20.04");stackScript.Images.Add("linode/ubuntu22.04");// UpdatestackScript =awaitlinodeClient.StackScript.Update(stackScript);
Delete
Deletes a private StackScript you have permission to read_write. You cannot delete a public StackScript.
LinodeClient linodeClient =newLinodeClient("apikey");// Get StackScript stackScript =awaitlinodeClient.StackScript.Get(1300722);// You can delete it by passing the object as a parameterawaitlinodeClient.StackScript.Delete(stackScript);// You can also delete it by passing the ID as a parameter.awaitlinodeClient.StackScript.Delete(1300722);