Scripts

Scripts are used to perform configuration and deployment related actions into available instances. They can be used to perform repeated actions on a group of instances such as Back-up, Monitoring, Deployment, Security Scans, Start/Stop Services etc.,

CoreStack™ currently supports the following type of scripts.

  1. Chef Cookbooks
  2. Puppet Modules
  3. Ansible Playbooks
  4. Shell Scripts
  5. PowerShell Scripts

Scripts have many similarities in terms of user experience with the Templates Feature. However they differ in few aspects. The table explains the differences.

Templates Scripts
Used to provision instances and other resources. Can perform actions on the resources Used to deploy / configure instances that are already available
Always mapped to one or more services Not mapped to any services
Service Account is mandatory for execution No Service Account is required. Can execute directly into one or more instances
Can have scripts embedded within. Each script execution will be treated as a separate task Can be executed separately (or) can combine multiple scripts to be executed together into one/more instances
Template Jobs are listed under the “Templates” tab in the Jobs page Script Jobs are listed under the “Scripts” tab in the Jobs page.(When you execute a template that has embedded scripts in it, even then you would see the Script Jobs here)
Custom Templates can be uploaded from a local file – YAML / JSON format Custom Scripts can be uploaded:
Chef Cookbooks: From Public URL / Git / Local File
Puppet Modules: From Public URL / Local File / Repository
Shell Scripts: Local File

As in Templates, a wide range of scripts are also provided preloaded. You too can upload custom scripts and execute them.

Scripts

Search and Filter Scripts

CoreStack™ offers search and filter functions to help quickly look for the scripts you need to execute.

The Text Search at the top right helps you search using any string available in the

  • Name of the Script
  • Script Type (Chef / Puppet / Ansible / Shell)
  • Category (Application, Database, Language etc.,)
  • OS Platform Supported (Ubuntu, RedHat, CentOS, Windows)

This offers powerful search function and you would be quickly get to the required Script with whatever minimal information you have to search with.

CoreStack™ also offers Filters to help you narrow down the list of templates by using one or a combination of filters.

Use the Reset icon above the filters to quickly remove all selected filters and view all results

The below Filter options are available:

  • Script Type
  • OS Platform
  • Script Category
  • When you select multiple values from a specific group (e.g. Script Type) your search result will contain scripts having either of the Script Type (‘OR’ condition within a Filter)
  • When you select values within different groups (e.g. Script Type – Chef and Category – Database), your search result will contain scripts that are related to Chef and Database. (‘AND’ condition between Filters)

Scripts Listing

Based on the search/filter used, the scripts that match the criteria would be listed on the right side – as shown below.

The tabs at the top represent the scope of the scripts. The values as shown are:

  • Marketplace Scripts: These scripts are available across all tenants and are usually created by the Product administrator. In our hosted version, it is managed by CoreStack™. In On-premise installations, it will be managed by the overall administrator. (These are Global scripts. Cannot be managed at Tenant level)
  • My Scripts: These scripts are created within the tenant and are listed only for the specific tenant members.

View Scripts

To get more information about a specific script:

  • Click on the script name to open the Script Detail page.
  • View the attributes related to the script and update the values if required by clicking on Update.Given below is a sample script detail page:

Scripts - chef
The below 3 tabs are also available in the Script Detail page:

Dependencies Tab: List the set of dependent scripts that are required for this cookbook. While adding a script, CoreStack™ can automatically scan for dependencies and add them here.

Attributes Tab: The list of Optional and Mandatory attributes required for executing the script are listed here. A sample is given below:

Script Actions

Given below are the actions that can be performed on a script:

  • Execute – Lets you execute the script (On-Demand)
  • Update – Modifies the attribute values or script source
  • Schedule – Similar to Execute, but schedules it to be run later once/multiple times.
  • Delete – Deletes the script

Execute Scripts

As specified earlier, Scripts are to be executed against selected target instance(s). The additional flexibility provided is that, you can execute multiple scripts across multiple instances.

  • Single Script in a single instance
  • Multiple Scripts in a single instance
  • Single Scripts into multiple instances
  • Multiple Scripts into multiple instances

A sample Chef script execution where 3 scripts are executed into 2 instances is shown below:



Once the set of instances along with their IP and credentials are provided, you can select the scripts to be executed within each instance. After completing these 2 steps, you can click on “Next” to provide the values for the input attributes required for executing these scripts. A sample is shown below:

The Script detail tab has the set of attributes for each script listed. Optional attributes are listed under Advanced.

Once all the script attributes are provided, you can click Run Now to execute the script in on-demand mode. Script Jobs can be viewed from the Scripts tab in the Job now. On clicking Run Now you  are redirected to this page.

The input parameters required are different based on the script type.

  1. Chef Cookbook – Cookbook Attributes (as shown in above example)
  2. Puppet Module – Manifest File
  3. Shell Script – Command Line Arguments

Schedule Scripts

Scheduling of scripts is very similar to execution except that you are scheduling the script to run at a specified time. You can also schedule the script to run multiple times as a recurring event (Daily / Weekly / Monthly).

To create a schedule, you need to use the Schedule () action for that script from the Scripts page. The list of schedules created for that specific tenant can be viewed from the schedule menu. There is also a calendar view that will display the schedules in day / week / month views.

Notification emails will be sent to the user each time the scheduled job starts and also when it completes (success/failure).

While creating a Schedule the same 2 tabs as execute will be displayed and corresponding details will be captured. There will be an additional tab for Schedule Details as shown below:

 

Create Custom Scripts

CoreStack™ also provides the option for users to upload their own scripts and use them. Use the Create button next to the Search bar at top right. Then enter the metadata for the script and upload the script file.

Meta data values to be entered:

Field Name Brief Description
Script Name Preferred name for the Script. If named based on the purpose, it will help easily identification and search.
Script Description Detailed description of the purpose and use case of the script. Can also include details about the version of the OS, Platform, versions supported etc.,
Script Type Chef / Puppet / Shell/ Ansible
Category Select appropriate value such as Application, Database, Language, Security etc.,
Scope Global: The script can be accessed by all users across all tenants. This value is available only for Product Admins. Will NOT be available in hosted version.
Tenant: The script can be accessed by all users within the Tenant
Tags Custom Key – value tags that can help in grouping or searching of templates
Multiple Tags can be added
Platform Choose (multiple) the platforms that are supported by the script
Script OS Choose  OS that is supported by the script
Minimum Requirements Disk, RAM and CPU capacity