Scripts

1. List Scripts

Retrieves a list of CoreStack Scripts for a given tenant. List includes both Marketplace Scripts & My Scripts. Script list can be filtered using scope, category etc., ID in the output is referred as Script ID

Syntax
(.venv)$ corestack scripts-list

Parameters

Attributes Description
scope Optional. Script Scope can be Global or Tenant
category Optional. Script Category to be filtered
limit Optional. Limits the number of scripts that can be retrieved
page_number Optional.Page number of the scripts list to be retrieved

Sample Output

2. View Script

Retrieves a CoreStack Script by its ID. Script ID can be fetched from the output of scripts-list command. Name, Description, Config Type (Shell, Ansible, Chef etc.,), Created By, Updated By etc., will be available as output

Syntax
(.venv)$ corestack script-show <script_id >

Parameters

Attributes Description
script_id Required.ID of the CoreStack Script to be retrieved

Sample Output

3. Execute Script

Executes a script by its ID with the inputs (Request Body). Request body is expected to vary for each script and the same can be identified using script content retrieved as part of script-show command

Syntax
(.venv)$ corestack script-execute <script_id> <body>

Parameters

Attributes Description
script_id Required. ID of the CoreStack Script to be executed
body Required. JSON content with the needed inputs to execute the script
Example:
{
“username”: “arunp”,
“platform”: “linux”,
“host”: “192.168.1.39”,
“key_file”: “”,
“parameters”: {
“chef”: {
“fail2ban”: {
“node[‘fail2ban’][‘protocol’]”: “tcp”,
“node[‘fail2ban’][‘findtime’]”: “600”,
“node[‘fail2ban’][‘ignoreip’]”: “127.0.0.1/8”,
“node[‘fail2ban’][’email’]”: “root@localhost”,
“node[‘fail2ban’][‘chain’]”: “INPUT”,
“node[‘fail2ban’][‘backend’]”: “polling”,
“node[‘fail2ban’][‘bantime’]”: “300”,
“node[‘fail2ban’][‘maxretry’]”: “5”,
“node[‘fail2ban’][‘banaction’]”: “iptablesmultiport”
}
},
“shell”: {},
“puppet”: {}
},
“keypair_flag”: “false”,
“password”: “Cloud@123”,
“port”: “22”,
“script_name”: [“Chef_Fail2ban”]
}