azure.azure_modules
azure.azure_modules
=========
This role has the latest updates and fixes for Azure modules from the devel
branch of the Ansible repository. If you need new features before Ansible's next release, installing this role is a great option.
Prerequisite
You should have an Ansible environment set up for Azure. For more information, check out the Ansible tutorials: Getting Started with Azure or Install and configure Ansible.
Installation
Install the role:
$ ansible-galaxy install azure.azure_modules
Upgrade the Azure Python SDKs needed for the new Azure modules:
$ pip install -r ~/.ansible/roles/azure.azure_modules/files/requirements-azure.txt
or
$ sudo pip install -r ~/.ansible/roles/azure.azure_modules/files/requirements-azure.txt
You may need the Python SDKs for several reasons:
A new module for a new Azure resource is added, and its SDK is not available in existing Ansible releases. You need to install this SDK.
Newer SDK versions may have changes that could break compatibility. It's important to install a specific version that works.
The required SDKs are listed in the ~/files/requirements-azure.txt file, found in the installed role folder, typically located at
~/.ansible/roles/files
.Pay attention to the installation location; it must match where the existing Azure Python SDKs are installed. If you face errors running the above command, check the installation location carefully.
For example, on Ubuntu, existing SDKs might be found in directories like
/home/<your-user-name>/.local/lib/python2.7/site-packages
or/usr/local/lib/python2.7/dist-packages
. The first is a user directory, and the second is a system directory that needs sudo access. This depends on how you installedansible
. In short, you should install the SDKs the same way asansible
so they are in the samesite-packages
folder.On macOS, you might find existing SDKs in
/Users/<your-user-name>/Library/Python/2.7/lib/python/site-packages
or/Library/Python/2.7/site-packages
.To find the correct
site-packages
path, you can check the location of an existing package, such asazure-mgmt-storage
, by running:$ pip show azure-mgmt-storage
The output will look something like this:
your-user-name@ansible:~$ pip show azure-mgmt-storage Name: azure-mgmt-storage Version: 1.5.0 Summary: Microsoft Azure Storage Management Client Library for Python Home-page: https://github.com/Azure/azure-sdk-for-python Author: Microsoft Corporation Author-email: [email protected] License: MIT License Location: /home/<your-user-name>/.local/lib/python2.7/site-packages Requires: azure-common, azure-mgmt-nspkg, msrestazure
From this, you can see whether SDKs are installed in a user or system directory. Use
pip install
for user directories andsudo pip install
for system directories.
Role Variables
None.
Dependencies
This role has no dependencies on other roles.
Example Playbook
- hosts: localhost
roles:
- { role: azure.azure_modules }
tasks:
- name: create storage account
azure_rm_storageaccount:
resource_group: resourcegroupname
name: storagename
account_type: Standard_LRS
License
MIT
latest Azure modules for provisioning Azure resources
ansible-galaxy install azure.azure_modules