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:
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.
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.
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
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.
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.