class AhvVmSmallProfile(VmProfile): """ Small Ahv Vm Profile""" # Profile variables nameserver = Var(DNS_SERVER, label="Local DNS resolver") # VM Spec for Substrate provider_spec = ahv_vm(resources=SmallAhvVmResources, name="SmallAhvVm") # Readiness probe for substrate (disabled is set to false, for enabling check login) readiness_probe = readiness_probe(credential=ref(Centos), disabled=False) # Only actions under Packages, Substrates and Profiles are allowed @action def __install__(): Task.Exec.ssh( name="Task1", filename=os.path.join("scripts", "mysql_install_script.sh") ) @action def __pre_create__(): Task.Exec.escript(name="Pre Create Task", script="print 'Hello!'") @action def test_profile_action(): Task.Exec.ssh(name="Task9", script='echo "Hello"')
class PHPDeployment(SimpleDeployment): """PHP deployment description""" # Add dependency to MySQL and to K8SDeployment1(deployment-level) dependencies = [ref(MySQLDeployment), ref(K8SDeployment1)] # Variables foo = Var("baz") # VM Spec provider_spec = read_provider_spec("specs/ahv_provider_spec.yaml") # Deployment level properties max_replicas = "2" # Service actions @action def test_action(): blah = Var("2") # noqa Task.Exec.ssh(name="Task6", script='echo "Hello"') Task.Exec.ssh(name="Task7", script='echo "Hello again"') @action def __install__(): Task.Exec.ssh(name="Task8", script="echo @@{foo}@@")
class Animal(Service): afoo = Var("abar") @action def animal_action(): pass
class Loyal(Service): lfoo = Var("lbar") @action def loyal_action(): pass
class XtractDslBlueprint(SimpleBlueprint): """Xtract Blueprint""" credentials = [ basic_cred("admin", ADMIN_PASSWD, name="default cred", default=True) ] nameserver = Var("10.40.64.15", label="Local DNS resolver") deployments = [XtractDeployment]
class SimpleLampBlueprint(SimpleBlueprint): """Simple blueprint Spec""" nameserver = Var(DNS_SERVER, label="Local DNS resolver") credentials = [ basic_cred(CRED_USERNAME, CRED_PASSWORD, name="default cred", default=True) ] deployments = [MySQLDeployment, PHPDeployment, K8SDeployment1] @action def test_profile_action(): # Profile level action Task.Exec.ssh(name="Task9", script='echo "Hello"', target=ref(MySQLDeployment)) # Call other actions PHPDeployment.test_action(name="Task10")
def test_action(): blah = Var("2") # noqa Task.Exec.ssh(name="Task6", script='echo "Hello"') Task.Exec.ssh(name="Task7", script='echo "Hello again"')
def custom_action_1(): blah = Var("2") # noqa Task.Exec.ssh(name="Task4", script='echo "Hello"') Task.Exec.ssh(name="Task5", script='echo "Hello again"')