コード例 #1
0
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}@@")
コード例 #2
0
ファイル: blueprint.py プロジェクト: darshanpyadav93/calm-dsl
class AHVVMforPHP(Substrate):
    """AHV VM config given by reading a spec file"""

    provider_spec = read_provider_spec("specs/ahv_provider_spec.yaml")
    provider_spec.spec["resources"]["nic_list"][0]["subnet_reference"][
        "uuid"
    ] = SUBNET_UUID
コード例 #3
0
class CreateELBSubstrate(Substrate):
    """ Existing Machine VM3 Substrate """

    provider_type = "EXISTING_VM"
    provider_spec = read_provider_spec("vm3_em_spec.yaml")

    readiness_probe = {"credential": ref(ROOT)}
コード例 #4
0
class VmDeployment(SimpleDeployment):
    """Single VM service"""

    # VM Spec
    provider_spec = read_provider_spec("specs/ahv_provider_spec.yaml")
    provider_spec.spec["resources"]["nic_list"][0]["subnet_reference"][
        "uuid"] = SUBNET_UUID
コード例 #5
0
ファイル: substrates.py プロジェクト: halsayed/calm
class PostgresEraSubstrate(Substrate):

    os_type = 'Linux'
    provider_type = 'EXISTING_VM'
    provider_spec = read_provider_spec('specs/postgres_era.yaml')

    readiness_probe = readiness_probe(
        connection_type='SSH',
        disabled=True,
        retries='5',
        connection_port=22,
        address='@@{ip_address}@@',
        delay_secs='60',
        credential=ref(CENTOS_CRED)
    )

    @action
    def __pre_create__(self):
        CalmTask.SetVariable.escript(filename='scripts/era_get_profile_ids.py', name='get profile ids',
                                     variables=['CLUSTER_ID', 'SOFTWARE_ID', 'SOFTWARE_VERSION', 'COMPUTE_ID',
                                                'NETWORK_ID', 'DB_PARAMETER', 'SLA_ID'])
        CalmTask.SetVariable.escript(filename='scripts/era_initiate_provision.py', name='initiate db provision',
                                     variables=['OPERATION_ID'])

        CalmTask.Exec.escript(filename='scripts/era_wait_for_operation.py', name='wait for operation')
        CalmTask.SetVariable.escript(filename='scripts/era_get_db_details.py', name='get db details',
                                     variables=['DB_ID', 'DBSERVER_ID', 'DBSERVER_IP'])


    @action
    def __post_delete__(self):
        CalmTask.Exec.escript(filename='scripts/era_delete_database.py', name='delete_postgres')
コード例 #6
0
class AHV_Worker(Substrate):
    """
    Worker AHV Spec
    Default 2 CPU & 2 GB of memory
    3 disks (3 X container data)
    """

    provider_spec = read_provider_spec("ahv_spec_worker.yaml")
コード例 #7
0
class AHV_Master(Substrate):
    """
    Master AHV Spec
    Default 2 CPU & 2 GB of memory
    6 disks (3 X etcd data & 3 X container data)
    """

    provider_spec = read_provider_spec("ahv_spec_master.yaml")
コード例 #8
0
class AHVPostgres(SimpleDeployment):
    """ AHV Postgres Deployment """

    provider_spec = read_provider_spec("ahv_spec.yaml")

    @action
    def __install__():
        Task.Exec.ssh(name="Install Postgres",
                      filename="scripts/postgres_PackageInstallTask.sh")
コード例 #9
0
class eGenterpriseSubstrate(Substrate):
    os_type = "Windows"
    provider_spec = read_provider_spec("ahv_spec_win.yaml")
    readiness_probe = {
        "disabled": False,
        "delay_secs": "90",
        "connection_type": "POWERSHELL",
        "connection_port": 5985,
        "credential": ref(DefaultCred),
    }
コード例 #10
0
class XtractVMS(Substrate):
    """Xtract Substrate"""

    provider_spec = read_provider_spec("ahv_spec.yaml")
    readiness_probe = {
        "disabled": True,
        "delay_secs": "0",
        "connection_type": "SSH",
        "connection_port": 22,
        "credential": ref(DefaultCred),
    }
コード例 #11
0
class ChefDeployment(SimpleDeployment):

    provider_spec = read_provider_spec("ahv_spec.yaml")

    @action
    def __install__():
        Task.Exec.ssh(name="Install Chef", filename="scripts/Install.sh")

    @action
    def __create__():
        Task.Exec.ssh(name="Configure", filename="scripts/Configure.sh")
コード例 #12
0
ファイル: Redis_Master_Slave.py プロジェクト: tuxtof/calm-dsl
class AWSRedisMasterSubstrate(Substrate):
    provider_spec = read_provider_spec("specs/substrate/aws_spec_centos.yaml")
    provider_spec.spec["name"] = "Redis_Master-@@{calm_array_index}@@-@@{calm_random}@@"
    provider_type = "AWS_VM"
    os_type = "Linux"
    readiness_probe = {
        "disabled": False,
        "delay_secs": "60",
        "connection_type": "SSH",
        "connection_port": 22,
        "credential": ref(DefaultCred),
    }
コード例 #13
0
class HaProxy_AHV(Substrate):
    """HaProxy AHV Substrate"""

    provider_spec = read_provider_spec("ahv_spec.yaml")
    provider_spec.spec["name"] = "ha-@@{calm_time}@@"
    readiness_probe = {
        "disabled": False,
        "delay_secs": "10",
        "connection_type": "SSH",
        "connection_port": 22,
        "credential": ref(CentOsCreds),
    }
コード例 #14
0
ファイル: Redis_Master_Slave.py プロジェクト: tuxtof/calm-dsl
class AzureRedisSlaveSubstrate(Substrate):
    os_type = "Linux"
    provider_type = "AZURE_VM"
    provider_spec = read_provider_spec("specs/substrate/azure_spec_centos.yaml")
    provider_spec.spec["name"] = "Redis_Slave-@@{calm_array_index}@@-@@{calm_random}@@"
    readiness_probe = {
        "disabled": False,
        "delay_secs": "60",
        "connection_type": "SSH",
        "connection_port": 22,
        "credential": ref(DefaultCred),
    }
コード例 #15
0
class Hadoop_Slave_AHV(Substrate):
    """Hadoop Slave Substrate"""

    provider_spec = read_provider_spec("ahv_spec.yaml")
    provider_spec.spec["name"] = "Hadoop_Slave-@@{calm_array_index}@@-@@{calm_time}@@"
    readiness_probe = {
        "disabled": False,
        "delay_secs": "0",
        "connection_type": "SSH",
        "connection_port": 22,
        "credential": ref(DefaultCred),
    }
コード例 #16
0
ファイル: blueprint.py プロジェクト: pupo888/calm-dsl
class AhvSubstrate(Substrate):
    """AHV VM config given by reading a spec file"""

    provider_spec = read_provider_spec("specs/ahv_provider_spec.yaml")
    provider_spec_editables = read_spec("specs/ahv_substrate_editable.yaml")

    readiness_probe = readiness_probe(
        connection_type="SSH",
        credential=ref(DefaultCred),
        disabled=True,
        editables_list=["connection_port", "retries"],
    )
コード例 #17
0
class WebServer2_AWS(Substrate):
    """WebServer2 AWS Substrate"""

    provider_type = "AWS_VM"
    provider_spec = read_provider_spec("aws_spec.yaml")
    provider_spec.spec["name"] = "wb2-aws-@@{calm_time}@@"
    readiness_probe = {
        "disabled": False,
        "delay_secs": "60",
        "connection_type": "SSH",
        "connection_port": 22,
        "credential": ref(CentOsCreds),
    }
コード例 #18
0
class Locust_AHV(Substrate):
    """Locust Load Generator AHV Substrate"""

    provider_spec = read_provider_spec("ahv_spec.yaml")
    provider_spec.spec["name"] = "Locust-@@{calm_time}@@"
    provider_spec.spec["resources"]["memory_size_mib"] = 2048
    readiness_probe = {
        "disabled": False,
        "delay_secs": "0",
        "connection_type": "SSH",
        "connection_port": 22,
        "credential": ref(CentOsCreds),
    }
コード例 #19
0
class CentosDeployment(SimpleDeployment):
    provider_spec = read_provider_spec('specs/centos-8.yaml')
    os_type = 'Linux'

    @action
    def __create__(self):
        CalmTask.Exec.escript(name='add_vm_to_hycu',
                              filename='scripts/add_vm_to_hycu.py')

    @action
    def __install__(self):
        # CalmTask.Exec.ssh(name='Update CentOS', script='sudo yum -y --quiet update')
        CalmTask.Exec.ssh(name='Update CentOS', script='echo "hello world"')
コード例 #20
0
ファイル: Redis_Master_Slave.py プロジェクト: tuxtof/calm-dsl
class GCPRedisSlaveSubstrate(Substrate):
    os_type = "Linux"
    provider_type = "GCP_VM"
    provider_spec = read_provider_spec("specs/substrate/gcp_spec_centos.yaml")
    provider_spec.spec["resources"]["sshKeys"] = [read_local_file("secrets/public_key")]
    readiness_probe = {
        "disabled": False,
        "delay_secs": "60",
        "connection_type": "SSH",
        "address": "@@{platform.networkInterfaces[0].accessConfigs[0].natIP}@@",
        "connection_port": 22,
        "credential": ref(DefaultCred),
    }
コード例 #21
0
ファイル: mssql.py プロジェクト: yannickstruyf3/calm-dsl
class MSSQLDeployment(SimpleDeployment):

    provider_spec = read_provider_spec("ahv_spec.yaml")
    os_type = "Windows"

    @action
    def __install__():
        CalmTask.Exec.powershell(name="PreRequisite",
                                 filename="scripts/PreRequisite.ps1")
        CalmTask.Exec.powershell(name="Install MSSQL",
                                 filename="scripts/Install.ps1")
        CalmTask.Exec.powershell(name="Open Firewall",
                                 filename="scripts/OpenFirewall.ps1")
コード例 #22
0
class VM_AHV_Small_Substrate(Substrate):
    os_type = "Windows"
    provider_type = "AHV_VM"
    provider_spec = read_provider_spec("specs/vdi-spec.yaml")
    provider_spec.spec["resources"]["guest_customization"]["sysprep"][
        "unattend_xml"] = read_file(os.path.join("scripts",
                                                 "Autounattend.xml"))
    readiness_probe = {
        "credential": ref(Windows_Local_Administrator),
        "connection_type": "POWERSHELL",
        "connection_port": 5985,
        "delay_secs": "120",
        "retries": "20",
    }
コード例 #23
0
class AristaSubstrate(Substrate):

    os_type = 'Linux'
    provider_type = 'EXISTING_VM'
    provider_spec = read_provider_spec('specs/arista_specs.yaml')

    readiness_probe = readiness_probe(
        connection_type='SSH',
        disabled=True,
        retries='5',
        connection_port=22,
        address='@@{ip_address}@@',
        delay_secs='60',
        credential=ref(ARISTA_CRED)
    )
コード例 #24
0
class RemoteVMS(Substrate):
    """Remote Desktop Substrate"""

    provider_spec = read_provider_spec('templates/singleVM_1nic_domain.yaml')

    readiness_probe = {
        'disabled': True,
        'connection_type': 'POWERSHELL',
        'connection_port': 5985,
        'credential': ref(LAB_DEFAULT)
    }
    os_type = 'Windows'

    @action
    def __pre_create__(self):
        CalmTask.SetVariable.escript(name='set lab network', filename='scripts/set_network_uuid.py',
                                     variables=['EXTERNAL_NETWORK'])
コード例 #25
0
ファイル: MCSA20-410.py プロジェクト: halsayed/lab-builder
class SRV1VMS(Substrate):
    """SRV1 Substrate"""

    provider_spec = read_provider_spec('templates/mcsa-20-41-SRV1.yaml')

    readiness_probe = {
        'disabled': True,
        'connection_type': 'POWERSHELL',
        'connection_port': 5985,
        'credential': ref(LAB_DEFAULT)
    }
    os_type = 'Windows'

    @action
    def __pre_create__(self):
        CalmTask.SetVariable.escript(name='set lab network',
                                     filename='scripts/set_network_uuid.py',
                                     variables=['LAB_NETWORK'])
コード例 #26
0
class MySQLDeployment(SimpleDeployment):
    """MySQL deployment description"""

    ENV = Var.WithOptions.Predefined.string(["DEV", "PROD"],
                                            default="DEV",
                                            is_mandatory=True,
                                            runtime=True)

    # VM Spec
    provider_spec = read_provider_spec("specs/ahv_provider_spec.yaml")

    # All service, package and substrate system actions
    @action
    def __install__():
        Task.Exec.ssh(name="Task1", filename="scripts/mysql_install_script.sh")

    @action
    def __start__():
        Task.Exec.ssh(name="Task2",
                      script="echo 'Service start in ENV=@@{ENV}@@'")

    @action
    def __stop__():
        Task.Exec.ssh(name="Task3",
                      script="echo 'Service stop in ENV=@@{ENV}@@'")

    @action
    def __pre_create__():
        Task.Exec.escript(name="Pre Create Task", script="print 'Hello!'")

    # Custom service actions
    @action
    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"')

    @action
    def custom_action_2():
        with parallel(
        ):  # All tasks within this context will be run in parallel
            Task.Exec.ssh(name="Task41", script="date")
            Task.Exec.ssh(name="Task51", script="date")
コード例 #27
0
class VmDeployment(SimpleDeployment):
    """Single VM service"""

    # VM Spec
    provider_spec = read_provider_spec("specs/ahv_provider_spec.yaml")
コード例 #28
0
class AHVPostgresSubstrate(Substrate):
    """Postgres Substrate"""

    provider_spec = read_provider_spec("ahv_spec.yaml")
コード例 #29
0
class SampleVM(Substrate):
    """Azure VM config given by reading a spec file"""

    os_type = "Windows"
    provider_type = "AZURE_VM"
    provider_spec = read_provider_spec("provider_spec.yaml")
コード例 #30
0
class VMWSubstrate(Substrate):
    os_type = "Linux"
    provider_type = "VMWARE_VM"
    provider_spec = read_provider_spec(
        "../../cli/blueprints/provider_spec.yaml")