{ "spec": { "name": "NewOCPProvisioningVM", "description": "", "resources": { "type": "USER", "service_definition_list": [ { "name": "Provisioning VM", "description": "", "port_list": [], "singleton": false, "tier": "", "depends_on_list": [], "variable_list": [ { "name": "blueprint_uuid", "description": "", "type": "LOCAL", "label": "", "attrs": {}, "val_type": "STRING", "value": "", "data_type": "BASE", "is_hidden": false, "is_mandatory": false }, { "name": "variable_list", "description": "", "type": "LOCAL", "label": "", "attrs": {}, "val_type": "STRING", "value": "", "data_type": "BASE", "is_hidden": false, "is_mandatory": false }, { "name": "launch_uuid", "description": "", "type": "LOCAL", "label": "", "attrs": {}, "val_type": "STRING", "value": "", "data_type": "BASE", "is_hidden": false, "is_mandatory": false }, { "name": "KUBEADMIN", "description": "", "type": "SECRET", "label": "", "attrs": {}, "val_type": "STRING", "value": "", "data_type": "BASE", "is_hidden": false, "is_mandatory": false }, { "name": "KUBECONFIG", "description": "", "type": "SECRET", "label": "", "attrs": {}, "val_type": "STRING", "value": "", "data_type": "BASE", "is_hidden": false, "is_mandatory": false } ], "action_list": [ { "name": "action_create", "description": "", "type": "system", "critical": true, "runbook": { "name": "Provisioning VM___create___runbook", "description": "", "main_task_local_reference": { "kind": "app_task", "name": "Provisioning VM___create___dag" }, "task_definition_list": [ { "name": "Provisioning VM___create___dag", "description": "", "type": "DAG", "target_any_local_reference": { "kind": "app_service", "name": "Provisioning VM" }, "attrs": { "edges": [] }, "child_tasks_local_reference_list": [], "variable_list": [], "retries": "", "timeout_secs": "" } ], "variable_list": [] } }, { "name": "action_start", "description": "", "type": "system", "critical": true, "runbook": { "name": "Provisioning VM___start___runbook", "description": "", "main_task_local_reference": { "kind": "app_task", "name": "Provisioning VM___start___dag" }, "task_definition_list": [ { "name": "Provisioning VM___start___dag", "description": "", "type": "DAG", "target_any_local_reference": { "kind": "app_service", "name": "Provisioning VM" }, "attrs": { "edges": [] }, "child_tasks_local_reference_list": [], "variable_list": [], "retries": "", "timeout_secs": "" } ], "variable_list": [] } }, { "name": "action_stop", "description": "", "type": "system", "critical": true, "runbook": { "name": "Provisioning VM___stop___runbook", "description": "", "main_task_local_reference": { "kind": "app_task", "name": "Provisioning VM___stop___dag" }, "task_definition_list": [ { "name": "Provisioning VM___stop___dag", "description": "", "type": "DAG", "target_any_local_reference": { "kind": "app_service", "name": "Provisioning VM" }, "attrs": { "edges": [] }, "child_tasks_local_reference_list": [], "variable_list": [], "retries": "", "timeout_secs": "" } ], "variable_list": [] } }, { "name": "action_delete", "description": "", "type": "system", "critical": true, "runbook": { "name": "Provisioning VM___delete___runbook", "description": "", "main_task_local_reference": { "kind": "app_task", "name": "Provisioning VM___delete___dag" }, "task_definition_list": [ { "name": "Provisioning VM___delete___dag", "description": "", "type": "DAG", "target_any_local_reference": { "kind": "app_service", "name": "Provisioning VM" }, "attrs": { "edges": [] }, "child_tasks_local_reference_list": [], "variable_list": [], "retries": "", "timeout_secs": "" } ], "variable_list": [] } }, { "name": "action_restart", "description": "", "type": "system", "critical": true, "runbook": { "name": "Provisioning VM___restart___runbook", "description": "", "main_task_local_reference": { "kind": "app_task", "name": "Provisioning VM___restart___dag" }, "task_definition_list": [ { "name": "Provisioning VM___restart___dag", "description": "", "type": "DAG", "target_any_local_reference": { "kind": "app_service", "name": "Provisioning VM" }, "attrs": { "edges": [] }, "child_tasks_local_reference_list": [], "variable_list": [], "retries": "", "timeout_secs": "" } ], "variable_list": [] } }, { "name": "action_soft_delete", "description": "", "type": "system", "critical": true, "runbook": { "name": "Provisioning VM___soft_delete___runbook", "description": "", "main_task_local_reference": { "kind": "app_task", "name": "Provisioning VM___soft_delete___dag" }, "task_definition_list": [ { "name": "Provisioning VM___soft_delete___dag", "description": "", "type": "DAG", "target_any_local_reference": { "kind": "app_service", "name": "Provisioning VM" }, "attrs": { "edges": [] }, "child_tasks_local_reference_list": [], "variable_list": [], "retries": "", "timeout_secs": "" } ], "variable_list": [] } } ], "container_spec": {} } ], "package_definition_list": [ { "name": "Setup", "description": "", "type": "CUSTOM", "options": { "install_runbook": { "name": "Setup___install___runbook", "description": "", "main_task_local_reference": { "kind": "app_task", "name": "Setup___install___dag" }, "task_definition_list": [ { "name": "Setup___install___dag", "description": "", "type": "DAG", "target_any_local_reference": { "kind": "app_service", "name": "Provisioning VM" }, "attrs": { "edges": [] }, "child_tasks_local_reference_list": [ { "kind": "app_task", "name": "Setup" } ], "variable_list": [], "retries": "", "timeout_secs": "" }, { "name": "Setup", "description": "", "type": "EXEC", "target_any_local_reference": { "kind": "app_service", "name": "Provisioning VM" }, "attrs": { "script_type": "sh", "script": "#!/bin/bash -e\n\n# Get machine IP\nMACHINE_IP=\"@@{address}@@\"\nSSH_USER=\"@@{CRED.username}@@\"\n\n# Inject ssh key pair into the VM for provisioning support\nmkdir -m 700 -p ~/.ssh\ncat <~/.ssh/id_rsa\n@@{CRED.secret}@@\nEOF\nchmod 600 ~/.ssh/id_rsa\ncat < ~/.ssh/id_rsa.pub\n@@{CRED.public_key}@@\nEOF\n\n# Update resolv.conf\n# Env setup\nmkdir -p openshift\ncd openshift\n\n# Install dependencies\nsudo yum -y update\nsudo yum -y install jq httpd python3\n\n# Disable selinux\nsudo setenforce 0\nsudo sed -i.bkp -r 's/(SELINUX=)enforcing/\\1disabled/g;s/^SELINUXTYPE=targeted/#&/g' /etc/selinux/config\n\n# Download Openshift installer\ncurl -o openshift-install-linux.tar.gz \"@@{openshift_install_linux}@@\"\ntar xzf openshift-install-linux.tar.gz\nsudo install -m 755 -o root openshift-install /sbin/\n\n# Download coreos-installer\ncurl -o coreos-installer \"@@{coreos_installer}@@\"\nsudo install -m 755 -o root coreos-installer /sbin/\n\n# Download Openshift client\ncurl -o openshift-client-linux.tar.gz \"@@{openshift_client_linux}@@\"\ntar xzf openshift-client-linux.tar.gz\nsudo install -m 755 -o root oc /sbin/\n\n# Download RHCOS 4.7 iso\ncurl -o rhcos-live.x86_64.iso \"@@{rhcos_live}@@\"\n\n# Create Web Repo\nmkdir web\ncp coreos-installer ~/openshift/web\nmv openshift-client-linux.tar.gz ~/openshift/web\nmv openshift-install-linux.tar.gz ~/openshift/web\n\n# Change ownership of openshift dir to expose iso and igntion over an http endpoint\nsudo chown -R apache: ~/openshift/web\nsudo chmod 755 \"/home/${USER}\"\n\n# Configure and start apache on port 8080\nsudo sed -i.bkp 's/Listen 80/&80/g' /etc/httpd/conf/httpd.conf\necho \"Alias /openshift /home/${SSH_USER}/openshift/web\n\nOptions -Indexes\nRequire all granted\n\" | sudo tee -a /etc/httpd/conf.d/openshift.conf\n# Enable and start apache\nsudo systemctl enable httpd\nsudo systemctl start httpd\n", "login_credential_local_reference": { "kind": "app_credential", "name": "CRED" } }, "child_tasks_local_reference_list": [], "variable_list": [], "retries": "", "timeout_secs": "" } ], "variable_list": [] }, "uninstall_runbook": { "name": "Runbook_for_Package_Setup_action_uninstall", "description": "", "main_task_local_reference": { "kind": "app_task", "name": "DAG_Task_for_Package_Setup_action_uninstall" }, "task_definition_list": [ { "name": "DAG_Task_for_Package_Setup_action_uninstall", "description": "", "type": "DAG", "target_any_local_reference": { "kind": "app_service", "name": "Provisioning VM" }, "attrs": { "edges": [] }, "child_tasks_local_reference_list": [], "variable_list": [], "retries": "", "timeout_secs": "" } ], "variable_list": [] } }, "service_local_reference_list": [ { "kind": "app_service", "name": "Provisioning VM" } ], "variable_list": [], "version": "" }, { "name": "Centos8", "description": "", "type": "SUBSTRATE_IMAGE", "options": { "name": "Centos84", "description": "", "resources": { "image_type": "DISK_IMAGE", "source_uri": "https://cloud.centos.org/centos/8-stream/x86_64/images/CentOS-Stream-GenericCloud-8-20220125.1.x86_64.qcow2", "architecture": "X86_64", "version": { "product_version": "1.0.0", "product_name": "Centos84" }, "checksum": {} } }, "service_local_reference_list": [], "variable_list": [], "version": "" } ], "published_service_definition_list": [], "substrate_definition_list": [ { "name": "Provisioning_VM", "description": "", "type": "AHV_VM", "os_type": "Linux", "create_spec": { "name": "Openshift-provisioning-@@{calm_array_index}@@-@@{calm_time}@@", "categories": {}, "resources": { "nic_list": [ { "network_function_nic_type": "INGRESS", "nic_type": "NORMAL_NIC", "subnet_reference": { "kind": "subnet", "name": "default", "uuid": "00000000-0000-0000-0000-000000000000" }, "network_function_chain_reference": null, "mac_address": "", "ip_endpoint_list": [] } ], "num_vcpus_per_socket": 1, "num_sockets": 2, "memory_size_mib": 4096, "power_state": "ON", "account_uuid": "a74171d4-726c-4279-a124-8503a085ebd7", "gpu_list": [], "disk_list": [ { "data_source_reference": { "name": "Centos8", "kind": "app_package", "uuid": "" }, "device_properties": { "device_type": "DISK", "disk_address": { "device_index": 0, "adapter_type": "SCSI" } }, "disk_size_mib": 0 } ], "guest_customization": { "sysprep": null, "cloud_init": { "user_data": "#cloud-config\nusers:\n - name: @@{CRED.username}@@\n ssh-authorized-keys:\n - @@{CRED.public_key}@@\n sudo: ['ALL=(ALL) NOPASSWD:ALL']\nwrite_files:\n - path: /etc/NetworkManager/conf.d/90-dns-none.conf\n content: |\n [main]\n dns=none" } }, "serial_port_list": [], "boot_config": { "boot_device": { "disk_address": { "device_index": 0, "adapter_type": "SCSI" } } } } }, "variable_list": [], "action_list": [], "readiness_probe": { "connection_type": "SSH", "connection_port": 22, "connection_protocol": "", "timeout_secs": "", "delay_secs": "60", "retries": "5", "address": "@@{platform.status.resources.nic_list[0].ip_endpoint_list[0].ip}@@", "disable_readiness_probe": false, "login_credential_local_reference": { "kind": "app_credential", "name": "CRED" } }, "editables": {} } ], "credential_definition_list": [ { "name": "CRED", "description": "", "type": "KEY", "username": "core", "secret": { "attrs": { "is_secret_modified": true } }, "editables": {} } ], "app_profile_list": [ { "name": "Nutanix", "deployment_create_list": [ { "published_service_local_reference_list": [], "package_local_reference_list": [ { "kind": "app_package", "name": "Setup" } ], "substrate_local_reference": { "kind": "app_substrate", "name": "Provisioning_VM" }, "depends_on_list": [], "variable_list": [], "action_list": [], "min_replicas": "1", "default_replicas": "1", "max_replicas": "1", "type": "GREENFIELD", "name": "decb8265_deployment", "options": {}, "description": "", "editables": {} } ], "variable_list": [ { "name": "coreos_installer", "description": "", "type": "LOCAL", "label": "CoreOS Installer URL", "attrs": {}, "val_type": "STRING", "value": "https://mirror.openshift.com/pub/openshift-v4/clients/coreos-installer/latest/coreos-installer", "data_type": "BASE", "editables": { "value": true }, "is_hidden": false, "is_mandatory": false }, { "name": "openshift_install_linux", "description": "", "type": "LOCAL", "label": "OpenShift Install Linux URL", "attrs": {}, "val_type": "STRING", "value": "https://mirror.openshift.com/pub/openshift-v4/clients/ocp/latest-@@{OCP_VERSION}@@/openshift-install-linux.tar.gz", "data_type": "BASE", "editables": { "value": true }, "is_hidden": false, "is_mandatory": false }, { "name": "openshift_client_linux", "description": "", "type": "LOCAL", "label": "OpenShift Client Linux URL", "attrs": {}, "val_type": "STRING", "value": "https://mirror.openshift.com/pub/openshift-v4/clients/ocp/latest-@@{OCP_VERSION}@@/openshift-client-linux.tar.gz", "data_type": "BASE", "editables": { "value": true }, "is_hidden": false, "is_mandatory": false }, { "name": "rhcos_live", "description": "", "type": "LOCAL", "label": "RHCOS Live ISO URL", "attrs": {}, "val_type": "STRING", "value": "https://mirror.openshift.com/pub/openshift-v4/dependencies/rhcos/@@{OCP_VERSION}@@/latest/rhcos-live.x86_64.iso", "data_type": "BASE", "editables": { "value": true }, "is_hidden": false, "is_mandatory": false }, { "name": "OCP_VERSION", "description": "OpenShift version: 4.8 and later requires AOS 5.20.2+ or 6.0.1+ || 4.7 and before requires 5.20+ or 5.15.6+", "type": "LOCAL", "label": "OpenShift version", "attrs": {}, "val_type": "STRING", "value": "4.9", "data_type": "BASE", "editables": { "value": true }, "options": { "type": "PREDEFINED", "choices": [ "4.9", "4.8", "4.7", "4.6" ] }, "is_hidden": false, "is_mandatory": true } ], "action_list": [ { "name": "Deploy OCP", "description": "", "type": "user", "critical": false, "runbook": { "name": "Nutanix_DeployOCP_runbook", "description": "", "main_task_local_reference": { "kind": "app_task", "name": "Nutanix_DeployOCP_dag" }, "task_definition_list": [ { "name": "Nutanix_DeployOCP_dag", "description": "", "type": "DAG", "attrs": { "edges": [ { "from_task_reference": { "kind": "app_task", "name": "Prepare Env" }, "to_task_reference": { "kind": "app_task", "name": "Auth" } }, { "from_task_reference": { "kind": "app_task", "name": "Auth" }, "to_task_reference": { "kind": "app_task", "name": "Fetch BP UUID" } }, { "from_task_reference": { "kind": "app_task", "name": "Fetch BP UUID" }, "to_task_reference": { "kind": "app_task", "name": "run Blueprint" } }, { "from_task_reference": { "kind": "app_task", "name": "run Blueprint" }, "to_task_reference": { "kind": "app_task", "name": "Monitor BP" } } ] }, "child_tasks_local_reference_list": [ { "kind": "app_task", "name": "Prepare Env" }, { "kind": "app_task", "name": "Auth" }, { "kind": "app_task", "name": "Fetch BP UUID" }, { "kind": "app_task", "name": "run Blueprint" }, { "kind": "app_task", "name": "Monitor BP" } ], "variable_list": [], "retries": "", "timeout_secs": "" }, { "name": "Prepare Env", "description": "", "type": "EXEC", "target_any_local_reference": { "kind": "app_service", "name": "Provisioning VM" }, "attrs": { "script_type": "sh", "script": "#!/bin/bash -e\n\ncd ~/openshift\n\n# Create ignition config used for generation of ignition files\ncat < install-config.yaml\napiVersion: v1\nbaseDomain: @@{BASE_DOMAIN}@@\nmetadata:\n name: @@{OCP_SUBDOMAIN}@@\ncompute:\n- name: worker # add argument\n replicas: @@{COMPUTE_NODES}@@\ncontrolPlane:\n name: master # add argument\n replicas: 3 # default\nnetworking:\n clusterNetwork:\n - cidr: @@{OCP_CLUSTER_NETWORK}@@\n hostPrefix: @@{OCP_CLUSTER_HOSTPREFIX}@@\n serviceNetwork:\n - @@{OCP_SERVICE_NETWORK}@@\n machineNetwork:\n - cidr: @@{OCP_MACHINE_NETWORK}@@\nplatform:\n none: {}\npullSecret: '@@{OCP_PULL_SECRET}@@'\nsshKey: \"@@{CRED.public_key}@@\"\nEOF\n\n# Ignition file generation\n# This will generate bootstrap.ign,master.ign and worker.ign files\n# Ignition files are used for RCHCOS installation(similar to kickstart for RHEL)\nopenshift-install create ignition-configs\n\n# Get private IP address of primary interface\n# MACHINE_IP=$(ip -4 a show eth0 | awk '/inet/ {gsub(/\\/[0-9]+/,\"\",$2);print $2}')\n\n# Embed MachineConfig for iscsid in ignition files\n\necho \"bootstrap.ign\nmaster.ign\nworker.ign\"| while read i; do\nj=${i%.*}\n#Check if self-deployed DNS must be patched into Iginition Files\njq '.systemd.units +=[{\"name\": \"iscsid.service\",\"enabled\": true}]' ${i} > ${j}_@@{OCP_SUBDOMAIN}@@.ign\n\ndone\n\n# Copy RHCOS Image\n# Embed bootstrap ignition config in ISO for first boot\n# All VMs initially boot from ISO with embedded bootstrap ignition\n# coreos-installer is used to install OS on hdd for specific roles via ignition files after first boot\ncoreos-installer iso ignition embed -i bootstrap_@@{OCP_SUBDOMAIN}@@.ign rhcos-live.x86_64.iso -o rhcos-@@{OCP_SUBDOMAIN}@@.iso\n\nsudo mv rhcos-@@{OCP_SUBDOMAIN}@@.iso ~/openshift/web\nsudo mv *_@@{OCP_SUBDOMAIN}@@.ign ~/openshift/web\nsudo chown apache: ~/openshift/web/*\n\nrm *.ign\nrm metadata.json\n\nrm .openshift*", "login_credential_local_reference": { "kind": "app_credential", "name": "CRED" } }, "child_tasks_local_reference_list": [], "variable_list": [], "retries": "", "timeout_secs": "" }, { "name": "Auth", "description": "", "type": "SET_VARIABLE", "target_any_local_reference": { "kind": "app_service", "name": "Provisioning VM" }, "attrs": { "script_type": "sh", "script": "cd openshift/auth\necho KUBECONFIG=\"$(base64 -w 0 kubeconfig)\"\necho KUBEADMIN=\"$(base64 -w 0 kubeadmin-password)\"\n\nrm kubeconfig\nrm kubeadmin-password", "login_credential_local_reference": { "kind": "app_credential", "name": "CRED" }, "eval_variables": [ "KUBECONFIG", "KUBEADMIN" ] }, "child_tasks_local_reference_list": [], "variable_list": [], "retries": "", "timeout_secs": "" }, { "name": "Fetch BP UUID", "description": "", "type": "SET_VARIABLE", "target_any_local_reference": { "kind": "app_service", "name": "Provisioning VM" }, "attrs": { "script_type": "static", "script": "#region define variables\njwt = '@@{calm_jwt}@@'\napi_server = \"localhost\"\napi_server_port = \"9440\"\napi_server_endpoint = \"/api/nutanix/v3/blueprints/list\"\nbp = \"@@{OCP_BP}@@\"\n\nlength = 100\nurl = \"https://{}:{}{}\".format(\n api_server,\n api_server_port,\n api_server_endpoint\n)\n#endregion\n\n# region prepare api call\nmethod = \"POST\"\nheaders = {\n 'Content-Type': 'application/json',\n 'Accept': 'application/json',\n 'Authorization': 'Bearer {}'.format(jwt)\n}\n\n# Compose the json payload\npayload = {\n \"kind\": \"blueprint\",\n \"offset\": 0,\n \"length\": length\n}\n# endregion\n\n#region make the api call\nprint(\"Making a {} API call to {}\".format(method, url))\nr = urlreq(\n url,\n verb=method,\n params=json.dumps(payload),\n headers=headers,\n verify=False\n)\n#endregion\n\n#region process the results\nif r.ok:\n for entity in json.loads(r.content)['entities']:\n #print entity\n if entity['status']['name'] == bp:\n blueprint_uuid=entity['status']['uuid']\n print 'blueprint_uuid='+blueprint_uuid\n# If the call failed\nelse:\n # print the content of the response (which should have the error message)\n print(\"Request failed\", json.dumps(\n json.loads(r.content),\n indent=4\n ))\n print(\"Headers: {}\".format(headers))\n print(\"Payload: {}\".format(payload))\n exit(1)\n# endregion\n", "eval_variables": [ "blueprint_uuid" ] }, "child_tasks_local_reference_list": [], "variable_list": [], "retries": "", "timeout_secs": "" }, { "name": "run Blueprint", "description": "", "type": "SET_VARIABLE", "target_any_local_reference": { "kind": "app_service", "name": "Provisioning VM" }, "attrs": { "script_type": "static", "script": " #region define variables\njwt = '@@{calm_jwt}@@'\napi_server = \"localhost\"\napi_server_port = \"9440\"\napi_server_endpoint = \"/api/nutanix/v3/blueprints/{}/runtime_editables\".format(\"@@{blueprint_uuid}@@\")\n\nlength = 100\nurl = \"https://{}:{}{}\".format(\n api_server,\n api_server_port,\n api_server_endpoint\n)\n#endregion\n\n# region prepare api call\nmethod = \"GET\"\nheaders = {\n 'Content-Type': 'application/json',\n 'Accept': 'application/json',\n 'Authorization': 'Bearer {}'.format(jwt)\n}\n\n\n#region make the api call\nprint(\"Making a {} API call to {}\".format(method, url))\nr = urlreq(\n url,\n verb=method,\n headers=headers,\n verify=False\n)\n#endregion\n\n#region process the results\nif r.ok:\n resp_json = json.loads(r.content)\n #variable_list = json.dumps(json_resp['resources'][0]['runtime_editables']['variable_list'])\n# If the call failed\nelse:\n # print the content of the response (which should have the error message)\n print(\"Request failed\")\n exit(1)\n# endregion\n\n\n#### RUN BP\n\n#region define variables\napi_server_endpoint = \"/api/nutanix/v3/blueprints/{}/simple_launch\".format(\"@@{blueprint_uuid}@@\")\n\nlength = 100\nurl = \"https://{}:{}{}\".format(\n api_server,\n api_server_port,\n api_server_endpoint\n)\n#endregion\n\n# region prepare api call\nmethod = \"POST\"\nheaders = {\n 'Content-Type': 'application/json',\n 'Accept': 'application/json',\n 'Authorization': 'Bearer {}'.format(jwt)\n}\n\n# Compose the json payload\npayload = {\n \"spec\": {\n \"app_name\": \"OpenShift @@{OCP_SUBDOMAIN}@@\",\n \"app_description\": \"Automated OCP Tenant\",\n \"app_profile_reference\": {\n \"kind\": \"app_profile\",\n \"name\": \"\"\n },\n \"runtime_editables\": {\n \"variable_list\":[],\n \"credential_list\":[]\n }\n }\n}\n\nif (@@{COMPUTE_NODES}@@==0):\n\tpayload['spec']['app_profile_reference']['name']='ControlPlaneOnly'\nelse:\n\tpayload['spec']['app_profile_reference']['name']='ControlPlaneCompute'\n\n\npayload['spec']['runtime_editables']['variable_list']=resp_json['resources'][0]['runtime_editables']['variable_list']\npayload['spec']['runtime_editables']['credential_list']=resp_json['resources'][0]['runtime_editables']['credential_list']\n\npayload['spec']['runtime_editables']['variable_list'][0]['value']['value']=\"@@{BASE_DOMAIN}@@\"\npayload['spec']['runtime_editables']['variable_list'][1]['value']['value']=\"@@{OCP_SUBDOMAIN}@@\"\npayload['spec']['runtime_editables']['variable_list'][2]['value']['value']=\"@@{address}@@\"\npayload['spec']['runtime_editables']['variable_list'][3]['value']['value']=\"@@{OCP_MACHINE_NETWORK}@@\"\npayload['spec']['runtime_editables']['variable_list'][4]['value']['value']='@@{KUBECONFIG}@@'\npayload['spec']['runtime_editables']['variable_list'][5]['value']['value']='@@{KUBEADMIN}@@'\npayload['spec']['runtime_editables']['variable_list'][6]['value']['value']='@@{platform.status.resources.nic_list[0].subnet_reference.uuid}@@'\npayload['spec']['runtime_editables']['variable_list'][7]['value']['value']='@@{COMPUTE_NODES}@@'\npayload['spec']['runtime_editables']['variable_list'][8]['value']['value']='@@{LBDNS_IP}@@'\n\npayload['spec']['runtime_editables']['credential_list'][0]['value']['secret']['attrs']['is_secret_modified']=True\n\nol_cred =\"\"\"@@{CRED.secret}@@\"\"\"\npayload['spec']['runtime_editables']['credential_list'][0]['value']['secret']['value']=ol_cred\n\nprint payload\n# endregion\n\n#region make the api call\nprint(\"Making a {} API call to {}\".format(method, url))\nr = urlreq(\n url,\n verb=method,\n params=json.dumps(payload),\n headers=headers,\n verify=False\n)\n#endregion\n\n#region process the results\nif r.ok:\n resp_json = json.loads(r.content)\n print \"launch_uuid={}\".format(resp_json[\"status\"][\"request_id\"])\n# If the call failed\nelse:\n # print the content of the response (which should have the error message)\n print(\"Request failed\", json.dumps(\n json.loads(r.content),\n indent=4\n ))\n print(\"Headers: {}\".format(headers))\n print(\"Payload: {}\".format(payload))\n exit(1)\n# endregion", "eval_variables": [ "launch_uuid" ] }, "child_tasks_local_reference_list": [], "variable_list": [], "retries": "", "timeout_secs": "" }, { "name": "Monitor BP", "description": "", "type": "EXEC", "target_any_local_reference": { "kind": "app_service", "name": "Provisioning VM" }, "attrs": { "script_type": "static", "script": " #region define variables\njwt = '@@{calm_jwt}@@'\napi_server = \"localhost\"\napi_server_port = \"9440\"\napi_server_endpoint = \"/api/nutanix/v3/blueprints/{}/pending_launches/{}\".format(\"@@{blueprint_uuid}@@\",\"@@{launch_uuid}@@\")\n\nlength = 100\nurl = \"https://{}:{}{}\".format(\n api_server,\n api_server_port,\n api_server_endpoint\n)\n#endregion\n\n# region prepare api call\nmethod = \"GET\"\nheaders = {\n 'Content-Type': 'application/json',\n 'Accept': 'application/json',\n 'Authorization': 'Bearer {}'.format(jwt)\n}\n\n\n#region make the api call\nprint(\"Making a {} API call to {}\".format(method, url))\nr = urlreq(\n url,\n verb=method,\n headers=headers,\n verify=False\n)\n#endregion\n\n#region process the results\nif r.ok:\n print r.content\n #variable_list = json.dumps(json_resp['resources'][0]['runtime_editables']['variable_list'])\n# If the call failed\nelse:\n # print the content of the response (which should have the error message)\n print(\"Request failed\")\n exit(1)\n# endregion\n" }, "child_tasks_local_reference_list": [], "variable_list": [], "retries": "", "timeout_secs": "" } ], "variable_list": [ { "name": "OCP_BP", "description": "This is the name for the second blueprint which is used for deploying an OpenShift cluster", "type": "LOCAL", "label": "OpenShift installer blueprint name", "attrs": {}, "val_type": "STRING", "value": "OCP-Installer", "data_type": "BASE", "editables": { "value": true }, "is_hidden": false, "is_mandatory": false }, { "name": "OCP_CLUSTER_HOSTPREFIX", "description": "The subnet prefix length to assign to each individual node. For example, if prefix is set to 23 then each node is assigned a /23 subnet out of the given Kubernetes pod network (format xx)", "type": "LOCAL", "label": "OpenShift host pod network prefix", "attrs": {}, "val_type": "STRING", "value": "23", "data_type": "BASE", "editables": { "value": true }, "is_hidden": false, "is_mandatory": false }, { "name": "OCP_CLUSTER_NETWORK", "description": "Internal Kubernetes network for Pod objects (format x.x.x.x/x). Make sure this network does not overlap with Service network, or networks in your datacenter", "type": "LOCAL", "label": "Kubernetes Pod network", "attrs": {}, "val_type": "STRING", "value": "10.128.0.0/14", "data_type": "BASE", "editables": { "value": true }, "is_hidden": false, "is_mandatory": false }, { "name": "OCP_SERVICE_NETWORK", "description": "Internal Kubernetes network for Services objects (format x.x.x.x/x). Make sure this network does not overlap with Pod network, or networks in your datacenter", "type": "LOCAL", "label": "Kubernetes Service network", "attrs": {}, "val_type": "STRING", "value": "172.30.0.0/16", "data_type": "BASE", "editables": { "value": true }, "is_hidden": false, "is_mandatory": false }, { "name": "OCP_MACHINE_NETWORK", "description": "This is the network subnet where OpenShift virtual machines will be deployed (format x.x.x.x/x)", "type": "LOCAL", "label": "Virtual machine network subnet", "attrs": {}, "val_type": "STRING", "value": "10.55.76.0/25", "data_type": "BASE", "editables": { "value": true }, "is_hidden": false, "is_mandatory": false }, { "name": "OCP_SUBDOMAIN", "description": "This is a dedicated subdomain for hosting your OpenShift cluster. The zone has to be delegated in your DNS server to the LB_DNS static IP address", "type": "LOCAL", "label": "OpenShift subdomain name", "attrs": {}, "val_type": "STRING", "value": "ocp1", "data_type": "BASE", "editables": { "value": true }, "is_hidden": false, "is_mandatory": false }, { "name": "BASE_DOMAIN", "description": "This is your base DNS main name (format xxx.yyy)", "type": "LOCAL", "label": "Domain name", "attrs": {}, "val_type": "STRING", "value": "ntnxlab.local", "data_type": "BASE", "editables": { "value": true }, "is_hidden": false, "is_mandatory": false }, { "name": "OCP_PULL_SECRET", "description": "Pull secret can be downloaded from https://console.redhat.com/openshift/install/pull-secret (format JSON)", "type": "LOCAL", "label": "OpenShift Pull Secret", "attrs": {}, "val_type": "STRING", "value": "", "data_type": "BASE", "editables": { "value": true }, "is_hidden": false, "is_mandatory": false }, { "name": "COMPUTE_NODES", "description": "Must be 2 or more. Control plane only not supported yet.", "type": "LOCAL", "label": "Number of compute nodes", "attrs": {}, "val_type": "STRING", "value": "2", "data_type": "BASE", "editables": { "value": true }, "regex": { "value": "^([1-4][0-9]|[2-9])$", "should_validate": true }, "is_hidden": false, "is_mandatory": false }, { "name": "LBDNS_IP", "description": "Free static IP for the LB_DNS service (format x.x.x.x)", "type": "LOCAL", "label": "Load Balancer & DNS static IP", "attrs": {}, "val_type": "STRING", "value": "", "data_type": "BASE", "editables": { "value": true }, "regex": { "value": "^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$", "should_validate": true }, "is_hidden": false, "is_mandatory": true } ] } } ], "snapshot_config_list": [], "restore_config_list": [] } ], "client_attrs": { "None": { "Service": { "Provisioning VM": { "dsl_name": "ProvisioningVM", "Action": {} } }, "Package": { "Centos8": { "dsl_name": "Centos8", "Action": {} }, "Setup": { "dsl_name": "Setup", "Action": {} } }, "Deployment": { "decb8265_deployment": { "dsl_name": "decb8265_deployment", "Action": {} } }, "Profile": { "Nutanix": { "dsl_name": "Nutanix", "Action": { "Deploy OCP": { "dsl_name": "DeployOCP" } } } }, "Substrate": { "Provisioning_VM": { "dsl_name": "Provisioning_VM", "Action": {}, "AhvVm": { "Openshift-provisioning-@@{calm_array_index}@@-@@{calm_time}@@": { "dsl_name": "Openshiftprovisioningcalm_array_indexcalm_time" } } } } } }, "default_credential_local_reference": { "kind": "app_credential", "name": "CRED" } } }, "api_version": "3.0", "metadata": { "name": "OCP-ProvisioningVM", "kind": "blueprint", "categories": {}, "spec_version": 1 } }