Developers Documentation

×

Warning

301 error for file:https://clearos.com/dokuwiki2/lib/exe/css.php?t=dokuwiki&tseed=82873f9c9a1f5784b951644363f20ef8

User Tools

Site Tools


Create and run executable scripts

ClearGLASS allows you to store and run executable scripts to configure newly created systems or modify existing servers. In order to achieve that, ClearGLASS needs SSH access to the specified machines. By providing a central place to store scripts, ClearGLASS can act as a library to store and reuse configurations and actions.

Adding executable scripts

Run executable scripts

You can add executable scripts to ClearGLASS in three ways:

Inline Editor

The simplest way, handy when we only have a few scripts to add. In the Scripts section, select Executable as the type, Inline as Source and paste your script. Press Add to save the script.

[image]

Github

To use a github repository as the source of our scripts, you need to specify the github repo (e.g. https://github.com/mistio/ansible-examples), and an entry point (which script to run, e.g. install.sh).

If the repository is private, we'll have to give access to user https://github.com/mistio-bot so it can clone it.

[image]

Importing through URL

Alternatively, we can specify a URL which is either a script, or a zip/tar file. If the URL is a zip/tar file, we will need to set the entrypoint (the path of the script) (e.g. scripts/main/install.sh)

If we specify a single script via URL, it has to result to the script in text. For example

https://gist.githubusercontent.com/mgogoulos/f7bed21367a20fcc66d8/raw/d4d32e065a6a0ca052a342a40a4c9e4bb4e4ad1c/simple.sh

[image]

Running executable scripts

Now that we have added our scripts, it is time to see how we can run them. We can do that on a newly created system, or on existing systems that ClearGLASS already has SSH access.

Running a script on a newly created machine

While we are creating a new machine through the Create Machine wizard, on the Script section we can add our script. Once the server is deployed, it will run the playbook.

[image]

Running a script on an existing system

We can also run our executable scripts on existing servers. Enter the scripts section, select the script, and select Run script. Then, select the machine from the list and click on Run. The script will be run on that machine. The list shows only the machines that ClearGLASS can connect to via SSH.

[image]

content/en_us/cg_create-and-run-executable-scripts.txt · Last modified: 2018/03/14 14:28 by admin2

https://clearos.com/dokuwiki2/lib/exe/indexer.php?id=content%3Aen_us%3Acg_create-and-run-executable-scripts&1710835028