Example #1
0
class SRV1Package(Package):
    """SRV1 Package"""

    services = [ref(SRV1VM)]
class VMwareRedisSlaveDeployment(Deployment):
    packages = [ref(VMwareSlavePackage)]
    substrate = ref(VMwareRedisSlaveSubstrate)
    min_replicas = "2"
    max_replicas = "4"
 def ScaleIn():
     """This action will scale in Redis slaves by given scale in count"""
     ScaleIn = CalmVariable.Simple.int("1", is_mandatory=True, runtime=True)
     CalmTask.Scaling.scale_in("@@{ScaleIn}@@",
                               target=ref(GCPRedisSlaveDeployment),
                               name="Scale in Slave")
Example #4
0
    def __install__():
        """Package installation tasks for the MySQL database server"""

        CalmTask.Exec.ssh(name="PackageInstallTask",
                          filename="scripts/mysql-install.sh",
                          target=ref(AHV_MySQLService))
class VMwareRedisMasterDeployment(Deployment):
    packages = [ref(VMwareMasterPackage)]
    substrate = ref(VMwareRedisMasterSubstrate)
    min_replicas = "1"
    max_replicas = "1"
Example #6
0
class PHPPackage(Package):
    """Example PHP package using Package as parent class"""

    services = [ref(PHPService)]
Example #7
0
class PHPDeployment(Deployment):
    """Sample deployment pulling in service and substrate references"""

    packages = [ref(PHPPackage)]
    substrate = ref(AHVMedVMForPHP)
Example #8
0
class ObjectsPackage(Package):
    """Nutanix Objects Package"""

    services = [ref(Objects)]
Example #9
0
class OscarPackage(Package):
    """Oscar Web App Package"""

    services = [ref(Oscar)]

    @action
    def __install__():

        CalmTask.Exec.ssh(
            name="01InstallPython",
            filename="scripts/oscar/package_install/01InstallPython.sh",
            cred=CentOsCreds,
        )

        CalmTask.SetVariable.escript(
            name="02CreateAlert",
            filename="scripts/oscar/package_install/02CreateAlert.py",
            variables=["ALERT_UUID"],
        )

        CalmTask.SetVariable.escript(
            name="03GetAlertUid",
            filename="scripts/oscar/package_install/03GetAlertUid.py",
            variables=["ALERT_UID"],
        )

        CalmTask.SetVariable.escript(
            name="04GetTriggerTypes",
            filename="scripts/oscar/package_install/04GetTriggerTypes.py",
            variables=["ALERT_TRIGGER_UUID"],
        )

        CalmTask.SetVariable.escript(
            name="05GetActionTypes",
            filename="scripts/oscar/package_install/05GetActionTypes.py",
            variables=[
                "ACTION_VMAMA_UUID", "ACTION_RA_UUID", "ACTION_EA_UUID"
            ],
        )

        CalmTask.SetVariable.escript(
            name="06CreatePlaybook",
            filename="scripts/oscar/package_install/06CreatePlaybook.py",
            variables=["PLAYBOOK_UUID"],
        )

    @action
    def __uninstall__():

        CalmTask.Exec.ssh(
            name="01UninstallSoftware",
            filename="scripts/oscar/package_uninstall/01UninstallSoftware.sh",
            cred=CentOsCreds,
        )

        CalmTask.Exec.escript(
            name="02DeleteAlert",
            filename="scripts/oscar/package_uninstall/02DeleteAlert.py",
        )

        CalmTask.Exec.escript(
            name="03DeletePlaybook",
            filename="scripts/oscar/package_uninstall/03DeletePlaybook.py",
        )
Example #10
0
class DC1Package(Package):
    """DC1 Package"""

    services = [ref(DC1VM)]
Example #11
0
class PostgresPackage(Package):
    """Postgres Database Package"""

    services = [ref(Postgres)]
Example #12
0
class RemoteDeployment(Deployment):
    """Remote Desktop Deployment"""

    packages = [ref(RemotePackage)]
    substrate = ref(RemoteVMS)
    min_replicas = '@@{COUNT}@@'
Example #13
0
class RemotePackage(Package):
    """Remote Desktop Package"""

    services = [ref(RemoteVM)]
Example #14
0
class SRV1Deployment(Deployment):
    """SRV1 Deployment"""

    packages = [ref(SRV1Package)]
    substrate = ref(SRV1VMS)
    min_replicas = '@@{COUNT}@@'
Example #15
0
class MySQLDeployment(Deployment):
    """Sample deployment pulling in service and substrate references"""

    name = "my sql deployment"
    packages = [ref(MySQLPackage)]
    substrate = ref(AHVVMforMySQL)
Example #16
0
class Era_PostgreSQL_DB(Substrate):
    """Postgres VM provisioned by Era"""

    provider_type = "EXISTING_VM"
    provider_spec = provider_spec({"address": "@@{DB_SERVER_IP}@@"})
    readiness_probe = {
        "disabled": True,
        "delay_secs": "0",
        "connection_type": "SSH",
        "connection_port": 22,
        "credential": ref(EraCreds),
    }

    @action
    def __pre_create__():

        CalmTask.SetVariable.escript(
            name="1GetClusterID",
            filename="scripts/postgres/precreate/1GetClusterID.py",
            variables=["CLUSTER_ID"],
        )
        CalmTask.SetVariable.escript(
            name="2GetProfileIDs",
            filename="scripts/postgres/precreate/2GetProfileIDs.py",
            variables=[
                "SOFTWARE_PROF_ID",
                "COMPUTE_PROF_ID",
                "NETWORK_PROF_ID",
                "DB_PARAM_ID",
                "TIMESTAMP",
            ],
        )
        CalmTask.SetVariable.escript(
            name="3GetSLAID",
            filename="scripts/postgres/precreate/3GetSLAID.py",
            variables=["SLA_ID", "DB_NAME"],
        )
        CalmTask.SetVariable.escript(
            name="4ProvisionDB",
            filename="scripts/postgres/precreate/4ProvisionDB.py",
            variables=["CREATE_OPERATION_ID"],
        )
        CalmTask.SetVariable.escript(
            name="5MonitorOperation",
            filename="scripts/postgres/precreate/5MonitorOperation.py",
            variables=["DB_ENTITY_NAME"],
        )
        CalmTask.SetVariable.escript(
            name="6GetDatabaseInfo",
            filename="scripts/postgres/precreate/6GetDatabaseInfo.py",
            variables=["DB_SERVER_IP", "DB_ID", "DB_SERVER_ID"],
        )

    @action
    def __post_delete__():

        CalmTask.SetVariable.escript(
            name="1CleanupDB",
            filename="scripts/postgres/postdelete/1CleanupDB.py",
            variables=["CLEANUP_OPERATION_ID"],
        )
        CalmTask.Exec.escript(
            name="2MonitorCleanupOp",
            filename="scripts/postgres/postdelete/2MonitorCleanupOp.py",
        )
        CalmTask.SetVariable.escript(
            name="3DeregisterDBServer",
            filename="scripts/postgres/postdelete/3DeregisterDBServer.py",
            variables=["DEREGISTER_OPERATION_ID"],
        )
        CalmTask.Exec.escript(
            name="4MonitorDeregOp",
            filename="scripts/postgres/postdelete/4MonitorDeregOp.py",
        )
Example #17
0
class AhvPackage(Package):
    """Example package with variables, install tasks and link to service"""

    foo = CalmVariable.Simple("bar")
    services = [ref(AhvService)]
Example #18
0
class PostgresDeployment(Deployment):
    """Postgres Database Deployment"""

    packages = [ref(PostgresPackage)]
    substrate = ref(Era_PostgreSQL_DB)
Example #19
0
class MySQLDeployment(Deployment):
    """Sample deployment pulling in service and substrate references"""

    packages = [ref(MySQLPackage)]
    substrate = ref(AHVMedVM)
Example #20
0
class ObjectsDeployment(Deployment):
    """Nutanix Objects Deployment"""

    packages = [ref(ObjectsPackage)]
    substrate = ref(Object_Storage_Bucket)
Example #21
0
    def __install__():
        """Package installation tasks for the Nginx web servers"""

        CalmTask.Exec.ssh(name="PackageInstallTask",
                          filename="scripts/apache-php-install.sh",
                          target=ref(AHV_ApachePHPService))
Example #22
0
class OscarDeployment(Deployment):
    """Oscar Web App Deployment"""

    packages = [ref(OscarPackage)]
    substrate = ref(Oscar_AHV)
Example #23
0
    def __install__():
        """Package installation tasks for the HAProxy server"""

        CalmTask.Exec.ssh(name="PackageInstallTask",
                          filename="scripts/haproxy-install.sh",
                          target=ref(AHV_HAProxyService))
Example #24
0
class LocustDeployment(Deployment):
    """Locust Load Generator Deployment"""

    packages = [ref(LocustPackage)]
    substrate = ref(Locust_AHV)
class GCPRedisMasterDeployment(Deployment):
    packages = [ref(GCPMasterPackage)]
    substrate = ref(GCPRedisMasterSubstrate)
    min_replicas = "1"
    max_replicas = "1"
Example #26
0
class HelloDeployment(Deployment):
    """Sample Deployment"""

    packages = [ref(HelloPackage)]
    substrate = ref(HelloSubstrate)
class GCPRedisSlaveDeployment(Deployment):
    packages = [ref(GCPSlavePackage)]
    substrate = ref(GCPRedisSlaveSubstrate)
    min_replicas = "2"
    max_replicas = "4"
Example #28
0
class VM_AHV_Small_Package(Package):
    services = [ref(VM)]
 def __install__():
     CalmTask.Exec.ssh(
         name="PackageInstallTask",
         filename="scripts/Master_Package.sh",
         cred=ref(DefaultCred),
     )
Example #30
0
class DC1Deployment(Deployment):
    """DC1 Deployment"""

    packages = [ref(DC1Package)]
    substrate = ref(DC1VMS)
    min_replicas = '@@{COUNT}@@'