How to do it...

  1. Create a resource group for deploying resources:
- name: Create resource group  azure_rm_resourcegroup:     name: example     location: "{{azure_region}}"     tags: 
        env: testing 
  tags: 
    - recipe4  
  1. Create a storage account for our VM disk:
- name: Create a storage account  azure_rm_storageaccount:     resource_group: example     name: examplestorage01     type: Standard_RAGRS 
     location: "{{azure_region}}"     tags:       - env: testing 
  tags: 
    - recipe4 
  1. Let's create our first VM in Azure Cloud:
- name: Create VM  azure_rm_virtualmachine:    resource_group: example    name: first_vm 
    location: "{{azure_region}}"    vm_size: Standard_D4    storage_account: examplestorage01    admin_username: cookbook    ssh_public_keys:      - path: /home/admin/.ssh/authorized_keys key_data: "ssh-rsa ...

Get Ansible 2 Cloud Automation Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.