| 1 | # Ansible collection for Azure |
| 2 | [](https://docs.ansible.com/ansible/latest/collections/azure/azcollection/index.html) |
| 3 | [](https://docs.ansible.com/ansible/latest/community/code_of_conduct.html) |
| 4 | [](LICENSE) |
| 5 | |
| 6 | ## Description |
| 7 | |
| 8 | This collection provides a series of Ansible modules and plugins for interacting with the [Azure](https://azure.microsoft.com). |
| 9 | |
| 10 | Documentation of individual modules is [available at the Ansible Galaxy](https://galaxy.ansible.com/ui/repo/published/azure/azcollection/docs/) |
| 11 | |
| 12 | ## Requirements |
| 13 | |
| 14 | - Python version >= 3.10 |
| 15 | - Ansible version >= 2.16 |
| 16 | |
| 17 | ## Installation |
| 18 | |
| 19 | Before using this collection, you need to install/force-install it with the Ansible Galaxy command-line tool: |
| 20 | |
| 21 | ``` |
| 22 | ansible-galaxy collection install azure.azcollection |
| 23 | ``` |
| 24 | |
| 25 | or force-install |
| 26 | ``` |
| 27 | ansible-galaxy collection install azure.azcollection --force |
| 28 | ``` |
| 29 | |
| 30 | You can also include it in a requirements.yml file and install it with `ansible-galaxy collection install -r requirements.yml`, using the format: |
| 31 | |
| 32 | ```yaml |
| 33 | collections: |
| 34 | - name: azure.azcollection |
| 35 | ``` |
| 36 | |
| 37 | To upgrade the collection to the latest available version, run the following command: |
| 38 | |
| 39 | ``` |
| 40 | ansible-galaxy collection install azure.azcollection --upgrade |
| 41 | ``` |
| 42 | |
| 43 | You can also install a specific version of the collection. Use the following syntax to install version 1.0.0: |
| 44 | |
| 45 | ``` |
| 46 | ansible-galaxy collection install azure.azcollection==1.0.0 |
| 47 | ``` |
| 48 | |
| 49 | See [using Ansible collections](https://docs.ansible.com/ansible/devel/user_guide/collections_using.html) for more details. |
| 50 | |
| 51 | --- |
| 52 | |
| 53 | After the collection is installed, please install the dependencies ([requirements.txt](https://github.com/ansible-collections/azure/blob/dev/requirements.txt)) required by the collection (adjust path to collection if necessary): |
| 54 | |
| 55 | ```bash |
| 56 | pip install -r ~/.ansible/collections/ansible_collections/azure/azcollection/requirements.txt |
| 57 | ``` |
| 58 | |
| 59 | ## Use Cases |
| 60 | |
| 61 | ### Playbook |
| 62 | |
| 63 | To use a module from Azure collection, please reference the full namespace, collection name, and modules name that you want to use: |
| 64 | |
| 65 | ```yaml |
| 66 | --- |
| 67 | - name: Using Azure collection |
| 68 | hosts: localhost |
| 69 | tasks: |
| 70 | - azure.azcollection.azure_rm_storageaccount: |
| 71 | resource_group: myResourceGroup |
| 72 | name: mystorageaccount |
| 73 | account_type: Standard_LRS |
| 74 | ``` |
| 75 | |
| 76 | Or you can add full namespace and collection name in the `collections` element: |
| 77 | |
| 78 | ```yaml |
| 79 | --- |
| 80 | - name: Using Azure collection |
| 81 | hosts: localhost |
| 82 | collections: |
| 83 | - azure.azcollection |
| 84 | tasks: |
| 85 | - azure_rm_storageaccount: |
| 86 | resource_group: myResourceGroup |
| 87 | name: mystorageaccount |
| 88 | account_type: Standard_LRS |
| 89 | ``` |
| 90 | |
| 91 | ### Role |
| 92 | |
| 93 | For existing Ansible roles, please also reference the full namespace, collection name, and modules name which used in tasks instead of just modules name. |
| 94 | |
| 95 | ### Plugin |
| 96 | |
| 97 | To use a plugin from Azure collection, please reference the full namespace, collection name, and plugins name that you want to use: |
| 98 | |
| 99 | ```yaml |
| 100 | --- |
| 101 | plugin: azure.azcollection.azure_rm |
| 102 | include_vm_resource_groups: |
| 103 | - ansible-inventory-test-rg |
| 104 | auth_source: auto |
| 105 | ``` |
| 106 | |
| 107 | ## Testing |
| 108 | |
| 109 | Test cases can be found under folder `tests`. |
| 110 | |
| 111 | ## Contributing |
| 112 | |
| 113 | There are many ways in which you can participate in the project, for example: |
| 114 | |
| 115 | - Submit bugs and feature requests, and help us verify as they are checked in |
| 116 | - Review source code changes |
| 117 | - Review the documentation and make pull requests for anything from typos to new content |
| 118 | - If you are interested in fixing issues and contributing directly to the code base, please see the [CONTRIBUTING](https://github.com/ansible-collections/azure/blob/dev/CONTRIBUTING.md) document |
| 119 | |
| 120 | ## Support |
| 121 | |
| 122 | As Red Hat Ansible Certified Content, this collection is entitled to support through the Ansible Automation Platform (AAP) using the **Create issue** button on the top right corner. If a support case cannot be opened with Red Hat and the collection has been obtained either from Galaxy or GitHub, there may be community help available on the [Ansible Forum](https://forum.ansible.com/). |
| 123 | |
| 124 | ## Release Notes and Roadmap |
| 125 | |
| 126 | See the [Changelog](https://github.com/ansible-collections/azure/blob/dev/CHANGELOG.md) |
| 127 | |
| 128 | |
| 129 | ## Related Information |
| 130 | |
| 131 | * [Ansible Official Documentation](https://docs.ansible.com/): A comprehensive Ansible user guide. |
| 132 | * [azure.azcolleciton Documentation](https://docs.ansible.com/ansible/latest/collections/azure/azcollection/index.html): Detailed information about the collection. |
| 133 | * [Azure Documentation](https://learn.microsoft.com/en-us/azure) |
| 134 | |
| 135 | ## License Information |
| 136 | |
| 137 | GNU General Public License v3.0 |
| 138 | |
| 139 | See [LICENSE](https://www.gnu.org/licenses/gpl-3.0.txt) to see the full text. |