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 
    - 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 
    - 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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.