Skip to content

Ansible Developer's (tool)Box, andebox, is a single script to assist Ansible developers by encapsulating some boilerplate tasks

Notifications You must be signed in to change notification settings

russoz-ansible/andebox

Repository files navigation

andebox

PyPI - Version PyPI - Python Version PyPI - Downloads Last Commit

Build Status docs codecov

andebox is a script to assist Ansible developers by encapsulating some boilerplate tasks, especially the ability of running tests from the root directory of the collection project without any additional setup.

andebox integration test demo

Highlights

Setup-less ansible-test

No need to clone in specific locations or keep track of env variables. Simply clone whichever collection you want and run the ansible-test command as:

$ andebox test -- sanity --docker default --test validate-modules plugins/modules/mymodule.py
$ andebox test -- unit --docker default test/units/plugins/modules/mymodule.py
$ andebox test -- integration --docker default mymodule

If you want to test your code against multiple versions of ansible-core or other component, you will like the tox-test subcommand as well.

Stats on ignore files

Gathering stats from the ignore files can be quite annoying, especially if they are long. One can run:

$ andebox ignores -s2.17 -fc validate-modules:parameter-state-invalid-choice
     1  plugins/modules/consul_session.py validate-modules:parameter-state-invalid-choice
     1  plugins/modules/osx_defaults.py validate-modules:parameter-state-invalid-choice
     1  plugins/modules/parted.py validate-modules:parameter-state-invalid-choice
     1  plugins/modules/rhevm.py validate-modules:parameter-state-invalid-choice

Runtime config

Quickly peek what is the runtime.yml status for a specific module:

$ andebox runtime scaleway_ip_facts
D modules scaleway_ip_facts: deprecation in 3.0.0 (current=2.4.0): Use community.general.scaleway_ip_info instead.

Or using a regular expression:

$ andebox runtime -r 'gc[pe]' | head -5
R lookup gcp_storage_file: redirected to community.google.gcp_storage_file
T modules gce: terminated in 2.0.0: Use google.cloud.gcp_compute_instance instead.
R modules gce_eip: redirected to community.google.gce_eip
R modules gce_img: redirected to community.google.gce_img
R modules gce_instance_template: redirected to community.google.gce_instance_template

where D=Deprecated, T=Tombstone, R=Redirect.

Run Integration Tests in Vagrant VMs

To run integration tests inside a VM managed by vagrant:

# Run test in VM named "fedora37" using sudo
$ andebox vagrant -n fedora37 -s -- --python 3.9 xfs_quota --color yes

andebox does not manage your Vagrantfile. The user is responsible for creating and setting up the VM definition.

Installation

Install it as usual:

pip install andebox

If you use pipx (strongly recommended), you may use:

pipx install andebox

About

Ansible Developer's (tool)Box, andebox, is a single script to assist Ansible developers by encapsulating some boilerplate tasks

Resources

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •