Azure modules for Ansible playbook
Перейти к файлу
xuzhang3 9b18d4c6e1
Merge pull request #156 from xuzhang3/f/generate_pwd
Replace plain text password with builtin.password
2024-09-02 15:53:53 +08:00
files Merged changes of Azure modules from Ansible repo 2019-09-11 09:16:43 +00:00
library Merged changes of Azure modules from Ansible repo 2019-09-11 09:16:43 +00:00
meta Add cloud platform information (#89) 2019-02-27 17:44:56 +08:00
module_utils Merged changes of Azure modules from Ansible repo 2019-09-04 17:28:00 +08:00
tasks adding message 2018-01-29 12:01:51 +08:00
tests replace plain text pwd with builtin.password 2024-09-02 15:44:46 +08:00
.gitignore Initial commit 2017-12-11 14:25:02 +08:00
.travis.yml Update .travis.yml 2019-05-05 14:12:11 +08:00
README.md Update title 2019-03-21 10:24:56 +08:00
SECURITY.md Microsoft mandatory file 2022-07-28 16:56:20 +00:00

README.md

azure.azure_modules

This role includes the latest changes and bug fixes for Azure modules from the devel branch of Ansible repository. If you cannot wait for Ansible's next release, installing this role is a good choice.

Prerequisite

The usage of this playbook role assumes that you've already setup an Ansible environment for Azure. For details, please refer to Ansible tutorial Getting Started with Azure or Install and configure Ansible.

Installation

  1. Install the role.
$ ansible-galaxy install azure.azure_modules
  1. Upgrade Azure Python SDKs required by 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

Several reasons for installing Python SDKs are listed here.

  • A new module is added to the role and this module is for one new Azure resource, which is not included in existing Ansible releases yet. The corresponding SDK for this new resource needs to be installed.

  • Newer versions of SDKs may introduce breaking API change. One specific working version should be installed here.

The required SDKs are listed in the ~/files/requirements-azure.txt file. The requirements-azure.txt file can be found in the installed role folder, which is usually at ~/.ansible/roles/files folder.

The tricky part is the installation location, which has to be the same as where existing Azure Python SDKs are installed. If you meet any error when executing the above command, please read below part carefully to double check the installation location.

Taking Ubuntu for example, the existing SDKs may be located in folders like /home/<your-user-name>/.local/lib/python2.7/site-packages or /usr/local/lib/python2.7/dist-packages. The former is a user folder and the latter is a system folder, which requires sudo access. This depends on how you have installed ansible. In short, you should install the SDKs the same way as you installed ansible so that the SDKs are in the same site-packages folder.

On macOS, the existing SDKs may be located in folders like /Users/<your-user-name>/Library/Python/2.7/lib/python/site-packages or /Library/Python/2.7/site-packages. Like Ubuntu, the former is a user folder and the latter is a system folder.

One way to figure out the correct site-packages path is to check the details of existing packages, say azure-mgmt-storage by running the command below:

$ pip show azure-mgmt-storage

You can get the output like below.

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: azpysdkhelp@microsoft.com
License: MIT License
Location: /home/<your-user-name>/.local/lib/python2.7/site-packages
Requires: azure-common, azure-mgmt-nspkg, msrestazure

From above information you can learn that the SDKs are installed in user site-packages folder and use pip install to install the listed packages. If the SDKs are installed in system path, use sudo pip install to install the listed packages.

Role Variables

No.

Dependencies

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