Create a Storage Account On Azure With Ansible

In this post, I will share with you how to create a storage account on Microsoft Azure cloud using Ansible.

This post follows the previous article on creating a dynamic inventory for Microsoft Azure with Ansible, which is not needed to complete this post.

Once your Ansible machine is configured to use Azure, you can create, manage and delete almost any service on Azure.

Storage Account

In the playbook below, I will create a storage account inside a resource group. In the configuration, I am using localhost as the host with the azure_rm module and note that I am also specifying the resource group I would like to use.

- name: Create a storage account on Microsoft Azure
  hosts: localhost
  connection: local
  gather_facts: yes
  tasks:
    - name: Create storage account
      azure_rm_storageaccount:
        resource_group: ubuntu-resources
        name: testaccountnt001
        account_type: Standard_LRS

To run the playbook, I will use the following command.

ansible-playbook playbooks/azure/storage-account.yml

Processing…
Success! You're on the list.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.