#30 inventory: dynamic containers need a way to be launched with optional capabilities
Closed Opened by merlinm.

Some tests require the docker container to be started with additional capabilities such as --cap-add=SYS_ADMIN. This is supported by supplying the docker_extra_args parameter to the standard-test-docker role. The standard-inventory-docker dynamic inventory script needs to support something similar.

Since the exact (optional) capabilities needed are specific to the test suite being run, we can't require this to be set as an environment variable. Perhaps additional docker parameters can be stored in a configuration file in the tests directory that is read by standard-inventory-docker?


The intent of using dynamic inventory is that a test can supply its own inventory files in the test/inventory directory. These may be completely different than the standard-inventory-* scripts ... or (in this case) these test/inventory scripts may setup certain environment variables and then invoke other inventory files.

I would suggest the following approach:

  • The /usr/share/ansible/inventory/standard-inventory-docker accepts additional arguments.
  • Tests which need to pass additional arguments, create their own inventory directory containing wrapper inventory scripts which invoke the standard-inventory-* inventory scripts with additional arguments.

Thank you for the suggestions. I'll start progress using that approach.

PR #33 should be sufficient to address this issue by enabling extra arguments for "docker run" to be taken from the DOCKER_EXTRA_ARGS environment variable. The rest is left up to a custom inventory script to be written and included in the tests/inventory directory.

This issue is addressed by PR #33, included in package update standard-test-roles-2.1 which is currently making its way to the rawhide and updates-testing repos. Note: the environment variable name was changed to TEST_DOCKER_EXTRA_ARGS.

As noted above, it is still up to each test to supply (an) appropriate inventory wrapper script(s) to provide the necessary settings to the scripts installed in /usr/share/ansible/inventory.

See PR#36 for an inventory merge script that finishes resolving this issue by allowing a single simple custom inventory script to wrap all of the scripts installed in /usr/share/ansible/inventory.

PR#36 solves this issue. Closing.

Metadata Update from @stefw:
- Issue assigned to stefw

Metadata Update from @stefw:
- Issue status updated to: Closed (was: Open)

Metadata Update from @stefw:
- Assignee reset

Metadata