|
| 1 | +# Contributing to the Cloud Azure Ops Ansible Collection |
| 2 | + |
| 3 | +We welcome community contributions to this collection. |
| 4 | +This guide provides clear instructions for contributors on how to set up their environment for contributing to the `cloud.azure_ops` Ansible Collection. |
| 5 | +If you find problems, please open an issue or create a Pull Request (PR) against this collection repository. |
| 6 | + |
| 7 | +## Prerequisites |
| 8 | + |
| 9 | +Make sure you have the following installed on your Machine: |
| 10 | + |
| 11 | +1. Python3 and pip3 |
| 12 | +2. Docker or Podman |
| 13 | +For more information on how containers are used with Ansible, refer to the [Containers section in the Ansible Community Documentation](https://docs.ansible.com/ansible/latest/dev_guide/testing_running_locally.html#containers). |
| 14 | +To allow managing Docker as a non-root user, refer to the [Linux post-installation steps for Docker Engine](https://docs.docker.com/engine/install/linux-postinstall/). |
| 15 | +3. Ansible |
| 16 | + This can be installed by running `pip3 install ansible` |
| 17 | + |
| 18 | +## Environment Setup |
| 19 | + |
| 20 | +To set up your environment for contributing to the Cloud Azure Ops Ansible Collection, follow these steps: |
| 21 | + |
| 22 | +> **_NOTE:_** Make sure to replace `<working directory>` with the actual path where you want to clone the repositories and set up your environment. |
| 23 | +
|
| 24 | +1. **Clone The "cloud.azure_ops" Ansible Collection**: |
| 25 | + This repository, includes a variety of Ansible roles and playbooks to help automate the management of resources on Azure. |
| 26 | + ```shell |
| 27 | + git clone https://github.com/redhat-cop/cloud.azure_ops.git <working directory>/ansible_collections/cloud/azure_ops |
| 28 | + ``` |
| 29 | + |
| 30 | +2. ***Clone the "Ansible collection for Azure" repository***: |
| 31 | + The GitHub repository containing all Ansible Modules and Plugins for interacting with Azure that utilized by the Roles in this repository. |
| 32 | + ```shell |
| 33 | + git clone https://github.com/ansible-collections/azure.git <working directory>/ansible_collections/azure/azcollection |
| 34 | + ``` |
| 35 | + |
| 36 | +3. ***Prepare Azure Configuration File***: |
| 37 | +Prepare the Azure configuration file at `<working directory>/ansible_collections/cloud/azure_ops/tests/integration/cloud-config-azure.ini`. A template of this file is available in [the Ansible repository](https://github.com/ansible/ansible/blob/devel/test/lib/ansible_test/config/cloud-config-azure.ini.template). Populate the file with your appropriate credentials and resource group information. |
| 38 | + |
| 39 | +## Running tests |
| 40 | + |
| 41 | +To run the tests, change directory into azure_ops directory: |
| 42 | +```shell |
| 43 | + cd <working directory>/ansible_collections/cloud/azure_ops |
| 44 | +``` |
| 45 | + |
| 46 | +### Integration tests |
| 47 | + |
| 48 | +Run Ansible Integration tests, using the following command: |
| 49 | +```shell |
| 50 | + ansible-test integration --docker |
| 51 | +``` |
| 52 | + |
| 53 | +To run a specific test, add the test name before the `--docker` flag: |
| 54 | +```shell |
| 55 | + ansible-test integration <test name> --docker |
| 56 | +``` |
| 57 | +The <test name> should be replaced with the specific folder name under `<working directory>/ansible_collections/cloud/azure_ops/tests/integration/targets/` that you want to test. |
| 58 | + |
| 59 | +### Sanity tests |
| 60 | + |
| 61 | +Run Ansible Sanity tests, using the following command: |
| 62 | +```shell |
| 63 | + ansible-test sanity --docker |
| 64 | +``` |
| 65 | + |
| 66 | +### Lint tests |
| 67 | + |
| 68 | +The project uses `ansible-lint` and `black`. |
| 69 | +To execute these tools, run: |
| 70 | +```shell |
| 71 | + tox -e linters |
| 72 | +``` |
| 73 | + |
0 commit comments