At Red Hat Tech Day Netherlands 2026 (3 June 2026, Bunnik), Red Hat announced 12 new content collections for AAP 2.7, including an expanded azure.azcollection covering Azure ML, App Configuration, Front Door, Storage, and Arc/HCI. Below is a runnable playbook that provisions a resource group, a Storage account, and an Azure ML workspace with Ansible.
Example Playbook
---
- name: Provision Azure ML and Storage resources
hosts: localhost
connection: local
gather_facts: false
vars:
resource_group: rg-ansible-ml-demo
location: westeurope
storage_account_name: ansiblemlstorage01
ml_workspace_name: ansible-ml-workspace
collections:
- azure.azcollection
tasks:
- name: Create resource group
azure.azcollection.azure_rm_resourcegroup:
name: "{{ resource_group }}"
location: "{{ location }}"
tags:
project: ansible-demo
managed_by: ansible
- name: Create Storage account for ML workspace
azure.azcollection.azure_rm_storageaccount:
resource_group: "{{ resource_group }}"
name: "{{ storage_account_name }}"
account_type: Standard_LRS
kind: StorageV2
tags:
project: ansible-demo
- name: Create Azure ML workspace
azure.azcollection.azure_rm_mlworkspace:
resource_group: "{{ resource_group }}"
name: "{{ ml_workspace_name }}"
location: "{{ location }}"
storage_account: "{{ storage_account_name }}"
sku: Basic
tags:
project: ansible-demo
- name: Report provisioned resources
ansible.builtin.debug:
msg: >
Provisioned resource group {{ resource_group }},
storage account {{ storage_account_name }},
and ML workspace {{ ml_workspace_name }} in {{ location }}.
What This Does
The play runs locally and calls three azure.azcollection modules in sequence. First, azure_rm_resourcegroup creates the container resource group in westeurope. Second, azure_rm_storageaccount provisions a StorageV2 account that the ML workspace uses for artifacts, datasets, and logs. Third, azure_rm_mlworkspace creates the Azure ML workspace itself, wiring in the storage account created in the previous task. Each module is idempotent — re-running the playbook against existing resources reports no change instead of failing or duplicating infrastructure.
This mirrors the kind of Efficiency and Scale gains Red Hat highlighted for the expanded collection: a single playbook stitches together Storage and ML provisioning that would otherwise require separate ARM templates, Bicep files, or manual portal clicks.
Notes / Gotchas
- Authentication: set
AZURE_SUBSCRIPTION_ID,AZURE_CLIENT_ID,AZURE_SECRET, andAZURE_TENANTas environment variables, or pass them as module parameters. On AAP 2.7, use a Microsoft Azure Resource Manager credential type instead of raw env vars. - Naming constraints: Storage account names must be globally unique, lowercase, and 3–24 alphanumeric characters —
ansiblemlstorage01is illustrative only and will collide if reused verbatim. - Install the collection before running:
ansible-galaxy collection install azure.azcollection, plus the Python SDK dependencies (azure-mgmt-storage,azure-mgmt-machinelearningservices, etc.) listed in the collection'srequirements.txt. - Region availability: not every Azure region supports Azure ML workspaces; verify
locationagainst current Azure ML region availability before running in production. - Check mode: run with
--check --difffirst against a scratch resource group to confirm the plan before provisioning real ML and Storage spend.
Takeaway
With the AAP 2.7 refresh of azure.azcollection, provisioning Azure ML workspaces alongside their backing Storage accounts is a straightforward, idempotent Ansible playbook rather than a multi-tool workflow.
Related Articles
- Ansible Playbook Example: Create an S3 Bucket with Encryption
- Ansible Playbook Example: Provision an EC2 Instance with Standard Tags
- Ansible Playbook Example: Request an Azure Resource Group with RBAC