Repository URL to install this package:
Version:
6.0.0 ▾
|
Table of contents
Thank you very much for taking time to improve this Ansible collection. We appreciate your every contribution. Please make sure you are familiar with the content presented in this document to avoid any delays during reviews or merge.
Please note that this project is released with following codes of conduct and by participating in the project you agree to abide by them:
If you are interested in joining us as a maintainer, please open an issue.
Notes:
Style guides are important because they ensure consistency in the content, look, and feel of a book or a website. Any contributions to this collection must adhere to the following rules:
ansible
when referring to the command line tool, package and so on.key: value
.
key=value
is suitable for ansible
ad-hoc execution, not for ansible-playbook
.name:
keyword associated with it.These rules are required for any contributions proposing a new Zabbix module or updating an existing one. Modules should:
DOCUMENTATION
block via extends_documentation_fragment
keyword.argument_spec
as a set of module parameters.zabbix-api
library as defined in collection requirements.It is recommended to use Docker for the testing as this repository is utilizing it for its own CI. Read Docker installation guide for more information.
Make sure you start your work on the current state of the repository with main
branch up to date. The best way to both try new changes and run shipped tests is by cloning the repository to Ansible project:
cd <ANSIBLE-PROJECT>/ mkdir -p collections/ansible_collections/community git clone git@github.com:<USERNAME>/community.zabbix.git collections/ansible_collections/community/zabbix
Functionality can be verified by looking at the documentation of a module:
ansible-doc community.zabbix.zabbix_host
Once this is done, you can reference modules and roles from testing playbook likes this:
- hosts: myserver roles: - role: community.zabbix.zabbix_agent zabbix_agent_server: 10.0.0.1 ... tasks: - name: Configure Zabbix host community.zabbix.zabbix_host: server_url: http://10.0.0.1/ ... delegate_to: localhost
This section is subject to change as our CI regarding roles is being reworked and may not work for you right now!
Roles make use of Molecule to verify and test the execution of each role. In order to start testing with Molecule, you need to install the required dependencies. Requirements file can be found in the root of the dj-wasabi/ansible-ci-base repository.
It is recommended to create a new Python virtual environment for this to not clutter your global Python installation. First, install the dependencies:
pip install -r requirements.txt
Note that Docker is required when testing roles as Molecule is configured to use it. Once everything is installed, validate your role changes with:
molecule test
Modules are tested via ansible-test
command. Configurations for integration and sanity tests for the command are contained within tests
directory. Refer to the official documentation for introduction to module integration testing within Ansible. Please note that this may fail if you get your directory structure wrong. If this happens, please see the start of Testing and Development regarding the placement of the collection.
Running test suites locally requires a few dependencies to be installed. Same as for the roles, it is recommended to use Python virtual environment:
pip install docker-compose zabbix-api
Integration test suite for modules can be run with the commands below:
export zabbix_version=X.Y docker-compose up -d ansible-test integration -v --color --retry-on-error --continue-on-error --diff docker-compose down
Notes:
zabbix_version=X.Y
will be expanded to Docker image ubuntu-X.Y-latest
Sanity test suite for the modules can be run with the commands:
ansible-test sanity -v --color --docker --python 3.6
It is recommended to use virtualenv for development and testing work to prevent any conflicting dependencies with other projects.
A few resources describing virtualenvs:
ansible-test
End note: Have fun making changes. If a feature helps you, others may find it useful as well and we will be happy to merge it.