Last active
December 21, 2015 04:18
-
-
Save dornatsky/6248101 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Simple manifest | |
# by vkhomenko | |
# | |
# We want to create VM, and run bash command on it. | |
# We need 2 steps: provision (ask amazon to launch instance) and run-command. | |
# To define order for our steps, we use "phase - precedingPhases". precedingPhases means we shall wait until phases listed there finished. | |
# Also, after starting node, we need a way to access it. Adding roleName, we adds our node to pool, named "computes-pool". | |
# Parameter "roles", passed to execrun, tells where to execute command. Right now it's just one node. | |
launch: | |
parameters: | |
- ip: | |
description: IP | |
default: 54.211.39.45 | |
steps: | |
- provision-vm: # Name of step | |
action: compute.grow # Predefined action that adds compute node | |
parameters: | |
ip: "{$.ip}" | |
roleName: computes-pool # Name of pool we create. | |
phase: init # Phase name, for ordering. | |
output: # After running, action "compute.grow" will return some variables, "ips" is one of them. | |
vm-ips: ips # We declare that our step should return it to step caller, so it can be accessible for other steps. | |
- run-command: # Name of step | |
action: execrun # Predefined action that executes shell command | |
parameters: | |
roles: [computes-pool] # Where to run command. We've created one vm on privious step. What square braces means??? | |
precedingPhases: [init] # We declare that step must be executed after "init" phase finished. | |
command: # Parameter for execrun, passes command to execute | |
- 'echo "Hello from execrun!"' | |
output: # What this step should return | |
cmd-out: stdout # Action "execrun" returns console output in "stdout" variable, we name it cmd-out, to use later | |
return: # Here we declare what our application should return | |
vm-host: # Name of variable | |
value: '{$.vm-ips}' #? Value we can from local variables of manifest ??? | |
description: Newly created VM address # Just description, to be shown in UI instead of "vm-host" | |
console-output: | |
value: '{$.cmd-out}' | |
destroy: # Mandatory paramenter | |
steps: | |
- destroy-vm: | |
action: compute.shrink-all # Predefined action, destroys all created VM's | |
# Running this manifest will result in: | |
# | |
# console-output {174.129.222.333 : Hello from execrun!} | |
# Newly created VM address 174.129.222.33 | |
# That means we created virtual machine and executed echo there |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment