Thank you for contributing to the Scaleway Ansible Collection! This guide will help you set up your development environment and run tests properly.
The repository must be placed in the correct path for Ansible to recognize it:
ansible_collections/scaleway/scaleway/
Always use a virtual environment when working on this project:
python -m venv .venv
source .venv/bin/activate # On macOS/LinuxInstall the required dependencies:
pip install -r requirements.txtRun integration tests with:
ansible-test integration scaleway_secret --requirementsNote: ansible-test does not read environment variables. For local testing with specific profiles, use ansible-playbook directly:
SCW_PROFILE=owner SCW_DEFAULT_REGION=fr-par SCW_CONFIG_PATH="/path/to/config.yml" ansible-playbook playbook.yamlRun unit tests with:
ansible-test units --python-interpreter .venv/bin/pythonMacOS Users: You may need to set this environment variable:
export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YESImportant: ansible-test sanity ignores the Python path argument, which is why you'll see import checks like:
try:
import scaleway
except ImportError:
# handle import errorTo test quickly your changes without writing a test you can export the collection path export ANSIBLE_COLLECTIONS_PATH=/Users/gnoale/git/scaleway/ansible_collections
- Be mindful of Python versions and dependencies
- The target system receives module code and is subject to your declared dependencies
When using types from the Scaleway SDK in function signatures, wrap them in quotes to avoid import issues during validation:
def example_function(client: "Client") -> str:
passExample playbook execution:
---
- hosts: localhost
tasks:
- name: Create a secret
scaleway.scaleway.scaleway_secret:
name: "test-secret"
protected: false
state: present
vars:
ansible_python_interpreter: .venv/bin/pythonExecute with:
SCW_PROFILE=owner SCW_DEFAULT_REGION=fr-par SCW_CONFIG_PATH="/path/to/config.yml" ansible-playbook playbook.yaml