diff --git a/roles/copr/backend/templates/resalloc/ibm-cloud-vm.j2 b/roles/copr/backend/templates/resalloc/ibm-cloud-vm.j2 index a123f14f33..fdc94d96ac 100755 --- a/roles/copr/backend/templates/resalloc/ibm-cloud-vm.j2 +++ b/roles/copr/backend/templates/resalloc/ibm-cloud-vm.j2 @@ -8,24 +8,23 @@ import argparse import datetime import logging import pipes -import re +import os import subprocess import sys from ibm_vpc import VpcV1 from ibm_cloud_sdk_core.authenticators import IAMAuthenticator -from ibm_cloud_sdk_core import ApiException DEFAULT_PLAYBOOK = "{{ provision_directory }}/libvirt-provision.yml" DEFAULT_TOKEN_FILE = "/var/lib/resallocserver/.ibm-cloud-token" DEFAULT_IMAGE = "{{ copr_builder_images.ibm_cloud.s390x }}" -subnet_id = "02f7-98674f68-aae1-4ea1-a889-5a0b7a07f4b8" -vpc_id = "r022-8438169e-d881-4bda-b603-d31fdf0f8b3a" -security_group_id = "r022-bf49b90e-c00f-4c68-8707-2936b47b286b" -my_key_id = "r022-3918e368-8e00-4e23-9119-5e3ce1eb33bd" -profile = "cz2-2x4" -zone_name = "jp-tok-2" +SUBNET_ID = "02f7-98674f68-aae1-4ea1-a889-5a0b7a07f4b8" +VPC_ID = "r022-8438169e-d881-4bda-b603-d31fdf0f8b3a" +SECURITY_GROUP_ID = "r022-bf49b90e-c00f-4c68-8707-2936b47b286b" +SSH_KEY_ID = "r022-3918e368-8e00-4e23-9119-5e3ce1eb33bd" +INSTANCE_TYPE = "cz2-2x4" +ZONE_NAME = "jp-tok-2" def resalloc_to_ibmcloud_name(name): @@ -86,11 +85,11 @@ def create_instance(service, instance_name, opts, log): Start the VM, name it "instance_name" """ instance_prototype_model = { - "keys": [{"id": my_key_id}], + "keys": [{"id": SSH_KEY_ID}], "name": instance_name, - "profile": {"name": profile}, + "profile": {"name": INSTANCE_TYPE}, "vpc": { - "id": vpc_id, + "id": VPC_ID, }, "boot_volume_attachment": { "volume": { @@ -105,14 +104,14 @@ def create_instance(service, instance_name, opts, log): "primary_network_interface": { 'name': 'primary-network-interface', 'subnet': { - "id": subnet_id, + "id": SUBNET_ID, }, "security_groups": [ - {"id": security_group_id}, + {"id": SECURITY_GROUP_ID}, ], }, "zone": { - "name": zone_name, + "name": ZONE_NAME, }, "volume_attachments": [{ "volume": { @@ -249,5 +248,4 @@ def _main(): if __name__ == "__main__": _main() - # vi: ft=python