How To Create an Action Script to Accommodate Multiple Credentials for VMs at the Blueprint Level


The use case here is that there are many credentials used for different VMs across all platforms. An Action script is needed that can be added at the Blueprint level and can accommodate multiple credentials.

One such example is shown below, where an action which is used across two different blueprints (shown in Figure 1). However, the requirement is to use the same action, but authenticate multiple credentials at the same time at the Blueprint level.

Figure 1:


The best solution here is to create a CloudBolt plugin that passes in the credentials for each job, and then runs the remote scripts as a sub-job. See example below in Figure 2:

Figure 2:

from cbhooks.models import RemoteScriptHook
def run (*args, job=None, **kwargs):
    username1 = ""
    password1 = ""
    username2 = ""
    password2 = ""
    remote_script_hook1 = RemoteScriptHook.objects.get(name='My Remote Script Name1')
    remote_script_hook1.run_as_job(script_username=username1, script_password=password1)
    remote_script_hook2 = RemoteScriptHook.objects.get(name='My Remote Script Name2')
    remote_script_hook2.run_as_job(script_username=username2, script_password=password2)

Have more questions? Submit a request


Please sign in to leave a comment.