diff --git a/src/ansible/README.md b/src/ansible/README.md index f899a6023..aa75a4285 100644 --- a/src/ansible/README.md +++ b/src/ansible/README.md @@ -16,6 +16,7 @@ Ansible is a suite of software tools that enables infrastructure as code. | Options Id | Description | Type | Default Value | |-----|-----|-----|-----| | version | Select the version to install. | string | latest | +| injections | Space delimitered list of python packages to inject into the main package env | string | - | diff --git a/src/ansible/devcontainer-feature.json b/src/ansible/devcontainer-feature.json index 0fbf95b14..17f56e7ac 100644 --- a/src/ansible/devcontainer-feature.json +++ b/src/ansible/devcontainer-feature.json @@ -1,6 +1,6 @@ { "id": "ansible", - "version": "2.0.17", + "version": "2.1.0", "name": "Ansible (via pipx)", "documentationURL": "http://github.com/devcontainers-extra/features/tree/main/src/ansible", "description": "Ansible is a suite of software tools that enables infrastructure as code.", @@ -12,6 +12,15 @@ "latest" ], "type": "string" + }, + "injections": { + "default": "", + "description": "Space delimitered list of python packages to inject into the ansible package env", + "proposals": [ + "hcloud", + "hcloud requests" + ], + "type": "string" } }, "installsAfter": [ diff --git a/src/ansible/install.sh b/src/ansible/install.sh index 17cae471e..4f49988da 100755 --- a/src/ansible/install.sh +++ b/src/ansible/install.sh @@ -13,6 +13,6 @@ $nanolayer_location \ install \ devcontainer-feature \ "ghcr.io/devcontainers-extra/features/pipx-package:1.1.9" \ - --option package='ansible-core' --option injections='ansible' --option version="$VERSION" + --option package='ansible-core' --option injections="ansible $INJECTIONS" --option version="$VERSION" --option includeDeps="true" echo 'Done!' diff --git a/test/ansible/scenarios.json b/test/ansible/scenarios.json index fe4ce9d59..f0246a912 100644 --- a/test/ansible/scenarios.json +++ b/test/ansible/scenarios.json @@ -24,5 +24,13 @@ "version": "2.13.0" } } + }, + "test_injections": { + "image": "mcr.microsoft.com/devcontainers/base:debian", + "features": { + "ansible": { + "injections": "hcloud" + } + } } } \ No newline at end of file diff --git a/test/ansible/test_injections.sh b/test/ansible/test_injections.sh new file mode 100644 index 000000000..25d659675 --- /dev/null +++ b/test/ansible/test_injections.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +set -e + +source dev-container-features-test-lib + +check "hcloud package is injected" bash -c "pipx list --include-injected | grep hcloud" + +reportResults