-
You will need to install azure-cli and configure your Azure account using
az login
command. -
Create Azure resource group
az group create -n <resource-group> -l <location>
-
Create Azure credentials
Create a service principal with
az ad sp create-for-rbac
and output the credentials that Packer needs:$ az ad sp create-for-rbac --query "{ client_id: appId, client_secret: password, tenant_id: tenant }" { "client_id": "f5b6a5cf-fbdf-4a9f-b3b8-3c2cd00225a4", "client_secret": "0e760437-bf34-4aad-9f8d-870be799c55d", "tenant_id": "72f988bf-86f1-41af-91ab-2d7cd011db47" }
NOTE: These are not real values! 😄
To authenticate to Azure, you also need to obtain your Azure subscription ID with
az account show
:$ az account show --query "{ subscription_id: id }" { "subscription_id": "e652d8de-aea2-4177-a0f1-7117adc604ee" }
You use the output from these two commands in the next step.
-
Create Azure storage account
az storage account create -n <storage-account> -g <resource-group> -l <location>
-
Create Azure storage container
az storage container create --account-name <storage-account> --name <container>
-
Download the IBM Spectrum Scale Data Management Edition install package (from Fix Central) and upload gpfs_rpms to storage container.
Example:
-
Create User-assigned managed identity
az identity create -g <resource-group> -n <identity-name>
You also need to obtain user assigned managed identity ID (Example output below):
$ az identity show --name ScaleIdentity --resource-group spectrum-scale-rg --query "{ id: id, principalId: principalId }" { "id": "/subscriptions/e652d8de-aea2-4177-a0f1-7117adc604ee/resourcegroups/spectrum-scale-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/ScaleIdentity", "principalId": "3d19ee92-cd9d-41c6-a753-e0d97f068032" }
-
Create Azure role assignment
az role assignment create --role "Storage Blob Data Reader" --scope "/subscriptions/<scope-subscription>/resourcegroups/<scope-resource-group>/providers/Microsoft.Storage/storageAccounts/<scope-resource-storage>/blobServices/default/containers/<scope-container>" --assignee-object-id <identity-principal-id>
Assign "Storage Blob Data Reader" to user-assigned managed identity (Example output below):
az role assignment create --role "Storage Blob Data Reader" --scope "/subscriptions/e652d8de-aea2-4177-a0f1-7117adc604ee/resourcegroups/spectrum-scale-rg/providers/Microsoft.Storage/storageAccounts/scalebucket/blobServices/default/containers/spectrumscale" --assignee-object-id 3d19ee92-cd9d-41c6-a753-e0d97f068032
-
Download a pre-built Packer binary for your operating system.
Below steps will provision Azure VM instance, installs IBM Spectrum Scale rpm's and creates a new AMI.
-
Change working directory to
packer_templates/azure/
.cd ibm-spectrum-scale-cloud-install/packer_templates/azure/
-
Create packer variable definitions file (
inputs.auto.pkrvars.hcl
) and provide infrastructure inputs.Minimal Example:
$ cat inputs.auto.pkrvars.hcl client_id = "f5b6a5cf-fbdf-4a9f-b3b8-3c2cd00225a4" client_secret = "0e760437-bf34-4aad-9f8d-870be799c55d" tenant_id = "72f988bf-86f1-41af-91ab-2d7cd011db47" subscription_id = "e652d8de-aea2-4177-a0f1-7117adc604ee" managed_image_resource_group_name = "spectrum-scale-rg" location = "eastus" image_publisher = "RedHat" image_offer = "RHEL" image_sku = "8.2" image_version = "latest" storage_accountname = "scalebucket" // Azure storage account. spectrumscale_container = "spectrumscale" // Azure storage container that contains gpfs/scale rpm's. ssh_username = "azureuser" user_assigned_managed_identities = ["/subscriptions/e652d8de-aea2-4177-a0f1-7117adc604ee/resourceGroups/spectrum-scale-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/ScaleIdentity"]
-
Run
packer build .
to create Azure managed image.
Name | Description | Type | Default | Required |
---|---|---|---|---|
client_id | The Active Directory service principal associated with your builder | string |
n/a | yes |
client_secret | The password or secret for your service principal. | string |
n/a | yes |
image_offer | Name of the publisher's offer to use for your base image (Azure Marketplace Images only). | string |
null |
no |
image_publisher | Name of the publisher to use for your base image (Azure Marketplace Images only). | string |
null |
no |
image_sku | SKU of the image offer to use for your base image (Azure Marketplace Images only). | string |
null |
no |
image_url | URL to a custom VHD to use for your base image. If this value is set, image_publisher, image_offer, image_sku should not be set. | string |
null |
no |
image_version | string |
null |
no | |
location | The location in which the resources will be created. Examples are East US, West US, etc. | string |
n/a | yes |
managed_image_name | Specify the managed image name where the result of the Packer build will be saved. | string |
"scale-image" |
no |
managed_image_resource_group_name | The name of the resource group in which the resources will be created. | string |
n/a | yes |
os_disk_size_gb | The size of the OS disk, in GB. | string |
"100" |
no |
spectrumscale_container | Data storage container which contains IBM Spectrum Scale rpm(s). | string |
n/a | yes |
ssh_username | The username to connect to SSH with. | string |
"azureuser" |
no |
storage_accountname | Azure storage account that contains container with IBM Spectrum Scale rpm(s). | string |
n/a | yes |
subscription_id | The subscription ID to use. | string |
n/a | yes |
tenant_id | The Active Directory tenant identifier, must provide when using service principals. | string |
n/a | yes |
user_assigned_managed_identities | A list of one or more fully-qualified resource IDs of user assigned managed identities to be configured on the VM. | list(string) |
n/a | yes |
vm_size | Size of the VM used for building. | string |
"Standard_A2_v2" |
no |