diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-14 20:03:01 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-14 20:03:01 +0000 |
commit | a453ac31f3428614cceb99027f8efbdb9258a40b (patch) | |
tree | f61f87408f32a8511cbd91799f9cececb53e0374 /collections-debian-merged/ansible_collections/community/hashi_vault | |
parent | Initial commit. (diff) | |
download | ansible-a453ac31f3428614cceb99027f8efbdb9258a40b.tar.xz ansible-a453ac31f3428614cceb99027f8efbdb9258a40b.zip |
Adding upstream version 2.10.7+merged+base+2.10.8+dfsg.upstream/2.10.7+merged+base+2.10.8+dfsgupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'collections-debian-merged/ansible_collections/community/hashi_vault')
51 files changed, 3756 insertions, 0 deletions
diff --git a/collections-debian-merged/ansible_collections/community/hashi_vault/.github/workflows/ansible-test.yml b/collections-debian-merged/ansible_collections/community/hashi_vault/.github/workflows/ansible-test.yml new file mode 100644 index 00000000..90642075 --- /dev/null +++ b/collections-debian-merged/ansible_collections/community/hashi_vault/.github/workflows/ansible-test.yml @@ -0,0 +1,183 @@ +# README FIRST +# 1. If you don't have unit tests remove that section +# 2. If your collection depends on other collections ensure they are installed, see "Install collection dependencies" +# If you need help please ask in #ansible-devel on Freenode IRC + +name: CI +on: + # Run CI against all pushes (direct commits, also merged PRs), Pull Requests + push: + pull_request: + schedule: + - cron: '0 14 * * *' +env: + NAMESPACE: community + COLLECTION_NAME: hashi_vault + ANSIBLE_FORCE_COLOR: true + +jobs: + +### +# Sanity tests (REQUIRED) +# +# https://docs.ansible.com/ansible/latest/dev_guide/testing_sanity.html + + sanity: + name: Sanity (Ⓐ${{ matrix.ansible }}) + strategy: + matrix: + ansible: + - stable-2.9 + - stable-2.10 + - devel + runs-on: ubuntu-latest + steps: + + # ansible-test requires the collection to be in a directory in the form + # .../ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}/ + + - name: Check out code + uses: actions/checkout@v2 + with: + path: ansible_collections/${{ env.NAMESPACE }}/${{ env.COLLECTION_NAME }} + + - name: Set up Python + uses: actions/setup-python@v2 + with: + # it is just required to run that once as "ansible-test sanity" in the docker image + # will run on all python versions it supports. + python-version: 3.8 + + # Install the head of the given branch (devel, stable-2.10) + - name: Install ansible-base (${{ matrix.ansible }}) + run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz --disable-pip-version-check + + # run ansible-test sanity inside of Docker. + # The docker container has all the pinned dependencies that are required + # and all python versions ansible supports. + - name: Run sanity tests + run: ansible-test sanity --docker -v --color + working-directory: ./ansible_collections/${{ env.NAMESPACE }}/${{ env.COLLECTION_NAME }} + +### +# Integration tests (RECOMMENDED) +# +# https://docs.ansible.com/ansible/latest/dev_guide/testing_integration.html + + +# If the application you are testing is available as a docker container and you want to test +# multiple versions see the following for an example: +# https://github.com/ansible-collections/community.zabbix/tree/master/.github/workflows + + integration: + runs-on: ubuntu-latest + name: I (Ⓐ${{ matrix.ansible }}+py${{ matrix.python }} | Vault ${{ matrix.vault }}) + strategy: + fail-fast: false + matrix: + ansible: + - stable-2.9 + - stable-2.10 + - devel + python: + - 2.7 + - 3.5 + - 3.6 + - 3.7 + - 3.8 + - 3.9 + vault: + - 1.6.0 + - 1.5.5 + - 1.4.7 + exclude: + - ansible: stable-2.9 + python: 3.9 + + steps: + - name: Initialize env vars + run: | + COLLECTION_PATH=ansible_collections/${NAMESPACE}/${COLLECTION_NAME} + LOOKUP_HASHI_VAULT_PATH=${COLLECTION_PATH}/tests/integration/targets/lookup_hashi_vault + LOOKUP_HASHI_VAULT_BIN=${LOOKUP_HASHI_VAULT_PATH}/lookup_hashi_vault/files/bin + LOOKUP_HASHI_VAULT_VARS=${LOOKUP_HASHI_VAULT_PATH}/lookup_hashi_vault/vars + + echo "COLLECTION_PATH=${COLLECTION_PATH}" >> ${GITHUB_ENV} + echo "LOOKUP_HASHI_VAULT_PATH=${LOOKUP_HASHI_VAULT_PATH}" >> ${GITHUB_ENV} + echo "LOOKUP_HASHI_VAULT_BIN=${LOOKUP_HASHI_VAULT_BIN}" >> ${GITHUB_ENV} + echo "LOOKUP_HASHI_VAULT_VARS=${LOOKUP_HASHI_VAULT_VARS}" >> ${GITHUB_ENV} + + - name: Check out code + uses: actions/checkout@v2 + with: + path: ${{ env.COLLECTION_PATH }} + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.8 + + - name: Cache for vault binaries + id: cache-vault + uses: actions/cache@v2 + with: + path: ${{ env.LOOKUP_HASHI_VAULT_BIN }} + key: ${{ runner.os }}-vault${{ matrix.vault }} # future: include version/arch when configurable + + # removing .gitignore lets the files in those dirs be sent to the container via ansible-test + # the files/bin dir will contain the vault binary downloaded a few steps later (or retrieved from cache) + # the vars/ dir will be used to write a file overriding role defaults (for Vault version) + - name: Prepare for Vault version and caching + run: | + rm -f "${LOOKUP_HASHI_VAULT_BIN}/.gitignore" + rm -f "${LOOKUP_HASHI_VAULT_VARS}/.gitignore" + echo '{ "vault_version": "${{ matrix.vault }}" }' > "${LOOKUP_HASHI_VAULT_VARS}/main.json" + + - name: Install ansible-base (${{ matrix.ansible }}) + run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz --disable-pip-version-check + + #TODO: remove dependency on community.crypto + - name: Find the latest version of community.crypto + run: | + # credit to https://gist.github.com/lukechilds/a83e1d7127b78fef38c2914c4ececc3c#gistcomment-3294173 + + cclu=$(curl -fs -o/dev/null -w %{redirect_url} https://github.com/ansible-collections/community.crypto/releases/latest) + echo "CC_LATEST=$(basename ${cclu})" >> $GITHUB_ENV + + - name: Cache for community.crypto + id: cache-cc + uses: actions/cache@v2 + with: + path: ansible_collections/community/crypto + key: collection-community.crypto-${{ env.CC_LATEST }} + + - name: Install collection dependencies + if: steps.cache-cc.outputs.cache-hit != 'true' + uses: actions/checkout@v2 + with: + repository: ansible-collections/community.crypto + ref: refs/tags/${{ env.CC_LATEST }} + path: ansible_collections/community/crypto + + # this will populate files/bin with the selected vault version binary + - name: Pre-download Vault + if: steps.cache-vault.outputs.cache-hit != 'true' + env: + ANSIBLE_ROLES_PATH: ../ + working-directory: ${{ env.LOOKUP_HASHI_VAULT_PATH }}/playbooks + run: ansible-playbook "download_vault.yml" -v + + # Run the integration tests + - name: Run integration test + run: ansible-test integration -v --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --docker --coverage + working-directory: ${{ env.COLLECTION_PATH }} + + # ansible-test support producing code coverage date + - name: Generate coverage report + run: ansible-test coverage xml -v --requirements --group-by command --group-by version + working-directory: ${{ env.COLLECTION_PATH }} + + # See the reports at https://codecov.io/gh/GITHUBORG/REPONAME + - uses: codecov/codecov-action@v1 + with: + fail_ci_if_error: false diff --git a/collections-debian-merged/ansible_collections/community/hashi_vault/.github/workflows/github-release.yml b/collections-debian-merged/ansible_collections/community/hashi_vault/.github/workflows/github-release.yml new file mode 100644 index 00000000..3890d771 --- /dev/null +++ b/collections-debian-merged/ansible_collections/community/hashi_vault/.github/workflows/github-release.yml @@ -0,0 +1,65 @@ +name: GitHub Release +on: + workflow_dispatch: + inputs: + version: + description: 'Version number to release' + required: true + +jobs: + + release: + name: Create GitHub Release + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.8 + + - name: Install PyYaml + run: pip install pyyaml + + - name: Validate version is published to Galaxy + run: curl --head -s -f -o /dev/null https://galaxy.ansible.com/download/community-hashi_vault-${{ github.event.inputs.version }}.tar.gz + + - name: Build release description + shell: python + run: | + import os + import yaml + + ver = '${{ github.event.inputs.version }}' + ver_anchor = str.replace(ver, '.', '-') + + with open('changelogs/changelog.yaml', 'r') as s: + ri = yaml.safe_load(s) + + summary = ri['releases'][ver]['changes']['release_summary'] + reldate = ri['releases'][ver]['release_date'] + + description = '''## Summary + Released: %s + + %s + + --- + + View the [complete changelog](https://github.com/ansible-collections/community.hashi_vault/blob/main/CHANGELOG.rst#v%s) to see all changes. + ''' % (reldate, summary, ver_anchor) + + with open(os.environ['GITHUB_ENV'], 'a') as e: + e.write("RELEASE_DESCRIPTION<<EOF\n%s\nEOF" % description) + + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.event.inputs.version }} + release_name: ${{ github.event.inputs.version }} + body: ${{ env.RELEASE_DESCRIPTION }} diff --git a/collections-debian-merged/ansible_collections/community/hashi_vault/CHANGELOG.rst b/collections-debian-merged/ansible_collections/community/hashi_vault/CHANGELOG.rst new file mode 100644 index 00000000..21785c43 --- /dev/null +++ b/collections-debian-merged/ansible_collections/community/hashi_vault/CHANGELOG.rst @@ -0,0 +1,83 @@ +=================================== +community.hashi_vault Release Notes +=================================== + +.. contents:: Topics + + +v1.1.0 +====== + +Release Summary +--------------- + +This release contains a new ``proxies`` option for the ``hashi_vault`` lookup. + +Minor Changes +------------- + +- hashi_vault - add ``proxies`` option (https://github.com/ansible-collections/community.hashi_vault/pull/50). + +v1.0.0 +====== + +Release Summary +--------------- + +Our first major release contains a single breaking change that will affect only a small subset of users. No functionality is removed. See the details in the changelog to determine if you're affected and if so how to transition to remediate. + +Breaking Changes / Porting Guide +-------------------------------- + +- hashi_vault - the ``VAULT_ADDR`` environment variable is now checked last for the ``url`` parameter. For details on which use cases are impacted, see (https://github.com/ansible-collections/community.hashi_vault/issues/8). + +v0.2.0 +====== + +Release Summary +--------------- + +Several backwards-compatible bugfixes and enhancements in this release. +Some environment variables are deprecated and have standardized replacements. + +Minor Changes +------------- + +- Add optional ``aws_iam_server_id`` parameter as the value for ``X-Vault-AWS-IAM-Server-ID`` header (https://github.com/ansible-collections/community.hashi_vault/pull/27). +- hashi_vault - ``ANSIBLE_HASHI_VAULT_ADDR`` environment variable added for option ``url`` (https://github.com/ansible-collections/community.hashi_vault/issues/8). +- hashi_vault - ``ANSIBLE_HASHI_VAULT_AUTH_METHOD`` environment variable added for option ``auth_method`` (https://github.com/ansible-collections/community.hashi_vault/issues/17). +- hashi_vault - ``ANSIBLE_HASHI_VAULT_ROLE_ID`` environment variable added for option ``role_id`` (https://github.com/ansible-collections/community.hashi_vault/issues/20). +- hashi_vault - ``ANSIBLE_HASHI_VAULT_SECRET_ID`` environment variable added for option ``secret_id`` (https://github.com/ansible-collections/community.hashi_vault/issues/20). +- hashi_vault - ``ANSIBLE_HASHI_VAULT_TOKEN_FILE`` environment variable added for option ``token_file`` (https://github.com/ansible-collections/community.hashi_vault/issues/15). +- hashi_vault - ``ANSIBLE_HASHI_VAULT_TOKEN_PATH`` environment variable added for option ``token_path`` (https://github.com/ansible-collections/community.hashi_vault/issues/15). +- hashi_vault - ``namespace`` parameter can be specified in INI or via env vars ``ANSIBLE_HASHI_VAULT_NAMESPACE`` (new) and ``VAULT_NAMESPACE`` (lower preference) (https://github.com/ansible-collections/community.hashi_vault/issues/14). +- hashi_vault - ``token`` parameter can now be specified via ``ANSIBLE_HASHI_VAULT_TOKEN`` as well as via ``VAULT_TOKEN`` (the latter with lower preference) (https://github.com/ansible-collections/community.hashi_vault/issues/16). +- hashi_vault - add ``token_validate`` option to control token validation (https://github.com/ansible-collections/community.hashi_vault/pull/24). +- hashi_vault - uses new AppRole method in hvac 0.10.6 with fallback to deprecated method with warning (https://github.com/ansible-collections/community.hashi_vault/pull/33). + +Deprecated Features +------------------- + +- hashi_vault - ``VAULT_ADDR`` environment variable for option ``url`` will have its precedence lowered in 1.0.0; use ``ANSIBLE_HASHI_VAULT_ADDR`` to intentionally override a config value (https://github.com/ansible-collections/community.hashi_vault/issues/8). +- hashi_vault - ``VAULT_AUTH_METHOD`` environment variable for option ``auth_method`` will be removed in 2.0.0, use ``ANSIBLE_HASHI_VAULT_AUTH_METHOD`` instead (https://github.com/ansible-collections/community.hashi_vault/issues/17). +- hashi_vault - ``VAULT_ROLE_ID`` environment variable for option ``role_id`` will be removed in 2.0.0, use ``ANSIBLE_HASHI_VAULT_ROLE_ID`` instead (https://github.com/ansible-collections/community.hashi_vault/issues/20). +- hashi_vault - ``VAULT_SECRET_ID`` environment variable for option ``secret_id`` will be removed in 2.0.0, use ``ANSIBLE_HASHI_VAULT_SECRET_ID`` instead (https://github.com/ansible-collections/community.hashi_vault/issues/20). +- hashi_vault - ``VAULT_TOKEN_FILE`` environment variable for option ``token_file`` will be removed in 2.0.0, use ``ANSIBLE_HASHI_VAULT_TOKEN_FILE`` instead (https://github.com/ansible-collections/community.hashi_vault/issues/15). +- hashi_vault - ``VAULT_TOKEN_PATH`` environment variable for option ``token_path`` will be removed in 2.0.0, use ``ANSIBLE_HASHI_VAULT_TOKEN_PATH`` instead (https://github.com/ansible-collections/community.hashi_vault/issues/15). + +Bugfixes +-------- + +- hashi_vault - ``mount_point`` parameter did not work with ``aws_iam_login`` auth method (https://github.com/ansible-collections/community.hashi_vault/issues/7) +- hashi_vault - fallback logic for handling deprecated style of auth in hvac was not implemented correctly (https://github.com/ansible-collections/community.hashi_vault/pull/33). +- hashi_vault - parameter ``mount_point`` does not work with JWT auth (https://github.com/ansible-collections/community.hashi_vault/issues/29). +- hashi_vault - tokens without ``lookup-self`` ability can't be used because of validation (https://github.com/ansible-collections/community.hashi_vault/issues/18). + +v0.1.0 +====== + +Release Summary +--------------- + +Our first release matches the ``hashi_vault`` lookup functionality provided by ``community.general`` version ``1.3.0``. + diff --git a/collections-debian-merged/ansible_collections/community/hashi_vault/FILES.json b/collections-debian-merged/ansible_collections/community/hashi_vault/FILES.json new file mode 100644 index 00000000..7bfd2975 --- /dev/null +++ b/collections-debian-merged/ansible_collections/community/hashi_vault/FILES.json @@ -0,0 +1,558 @@ +{ + "files": [ + { + "name": ".", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "README.md", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "1ac5ef49feca71e94e3cc21a5ed362edf7ce4c4c2d5888585dfdfd1a5b258e95", + "format": 1 + }, + { + "name": "tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/requirements.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "120522e4fd93584ed7358b854d899f619aad18816eb72bb7068378a3ea806cda", + "format": 1 + }, + { + "name": "tests/integration", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/setup_pkg_mgr", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/setup_pkg_mgr/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/setup_pkg_mgr/tasks/main.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "4a3ac16c80747874defcb3b8bcd0cf796fb847b440ee5ae240d7b5b71cf32c0e", + "format": 1 + }, + { + "name": "tests/integration/targets/setup_remote_tmp_dir", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/setup_remote_tmp_dir/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/setup_remote_tmp_dir/tasks/main.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "bcb3221a68dc87c7eae0c7ea50c0c0e81380932bf2e21a3dfdee1acc2266c3f3", + "format": 1 + }, + { + "name": "tests/integration/targets/setup_remote_tmp_dir/tasks/default-cleanup.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e273324ab90d72180a971d99b9ab69f08689c8be2e6adb991154fc294cf1056e", + "format": 1 + }, + { + "name": "tests/integration/targets/setup_remote_tmp_dir/tasks/default.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "2441ac1753320d2cd3bea299c160540e6ae31739ed235923ca478284d1fcfe09", + "format": 1 + }, + { + "name": "tests/integration/targets/setup_remote_tmp_dir/handlers", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/setup_remote_tmp_dir/handlers/main.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "050157a29c48915cf220b3cdcf5a032e53e359bdc4a210cd457c4836e8e32a4d", + "format": 1 + }, + { + "name": "tests/integration/targets/lookup_hashi_vault", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/lookup_hashi_vault/aliases", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "0ebcc5167635d69cbbbd75ccc9f97ad9a12ba9870a1831006bc40fb0e2ef2388", + "format": 1 + }, + { + "name": "tests/integration/targets/lookup_hashi_vault/playbooks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/lookup_hashi_vault/playbooks/install_dependencies.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "268f960a48afc6de53caac915ca8b5972085954c04a1e1e71c12574aef452ea2", + "format": 1 + }, + { + "name": "tests/integration/targets/lookup_hashi_vault/playbooks/download_vault.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "6a8f30f380f51239b6e4cb6b9ab57a45694896494dc2f828b5ac4054918685cf", + "format": 1 + }, + { + "name": "tests/integration/targets/lookup_hashi_vault/playbooks/test_lookup_hashi_vault.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "6bc7d56ec3dcfe1fd58c3700fd69d3ee7fdc3d2ba383a9ffcf946cac68e8be0b", + "format": 1 + }, + { + "name": "tests/integration/targets/lookup_hashi_vault/runme.sh", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "8d5c514e96e22ef58a4bb24d8d263c046822805e050e1a1438ada07e983bd2c6", + "format": 1 + }, + { + "name": "tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/vars", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/vars/.gitignore", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "aae815b9313ef60fb99d51bec324f3de1cea5256d6bbf58a660578b3e2d5815c", + "format": 1 + }, + { + "name": "tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/tasks/main.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "92ffaa8606c22c1c28e9b16ff64af5679bc7102b6f13f602d30749ce8af682bd", + "format": 1 + }, + { + "name": "tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/tasks/vault_server_auth_setup.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "d05c0baa51e113752c6f7819aba107ad3aa50362c4e72f20e28086966ebfae26", + "format": 1 + }, + { + "name": "tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/tasks/tinyproxy_server.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "4ffc27b571ec4a8554c36ea39514001c4ee85c956d5faa78c0f99f0774cd1d36", + "format": 1 + }, + { + "name": "tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/tasks/tests.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "b70468f3d4c79b4cd73f83558c465e99eec87672e802a2ec8e6c1eda63c421b0", + "format": 1 + }, + { + "name": "tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/tasks/vault_server.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "aac827b925500739065620a2e3407da8b0e1795ccebe576c4f57c6b7d6236a1e", + "format": 1 + }, + { + "name": "tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/tasks/approle_secret_id_less_test.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "aa82ef30657904796870b171dc6c8e3cc360b30db7a21706322bccf113461fa7", + "format": 1 + }, + { + "name": "tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/tasks/approle_test.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "87e9e206e09d4059543e0e94af5318497c25e18a5ea8990e9ddf6623fab82992", + "format": 1 + }, + { + "name": "tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/tasks/token_test.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "8276b15ce07703611c7da50249840458cecfa9c2fea2da46074994b27bc746a7", + "format": 1 + }, + { + "name": "tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/tasks/jwt_test.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "1d0fd7667e0e6eeff5d9293d8d2f539cdba18aecc141a4b8ea6abb91c9272ca7", + "format": 1 + }, + { + "name": "tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/tasks/approle_setup.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "dafc3f6cd208872a3f0bd8b3eed12e9e188496ea2a07b44b68e35ec50bf23e28", + "format": 1 + }, + { + "name": "tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/tasks/jwt_setup.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9cad4eff0af4b7f561059c72edd086ee9d4a3996e0dd273945cc2f7f84a40885", + "format": 1 + }, + { + "name": "tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/tasks/token_setup.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "4fa9cd5c2dab84da904bdc1c277ad49e75c4cb2123fbfd9db74112c9408cf79a", + "format": 1 + }, + { + "name": "tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/tasks/vault_download.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9193a4697cbf7676dba3d1358b03cd682d26bba452ebb3ff51ef9c867e235007", + "format": 1 + }, + { + "name": "tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/tasks/approle_secret_id_less_setup.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "29414866822f202840f136bb87a3768237fcdcd395359ec241c565086cc0b14f", + "format": 1 + }, + { + "name": "tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/defaults", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/defaults/main.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "47d4e2167943ab8bcfba97c9a5c05d6a53fe03e4b28b78ee799c01f33cd8d4d2", + "format": 1 + }, + { + "name": "tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/files", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/files/jwt_private.pem", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "d9adb929b5968b9305a591628a4ed2cb98d2aa4209f2da2d3a44a6fb46a17ba1", + "format": 1 + }, + { + "name": "tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/files/bin", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/files/bin/.gitignore", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "aae815b9313ef60fb99d51bec324f3de1cea5256d6bbf58a660578b3e2d5815c", + "format": 1 + }, + { + "name": "tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/files/token_invalid.jwt", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9292b2ff2f4a057d4c12de49e429ee861bb181c1ceae52726b1125acbae5c22e", + "format": 1 + }, + { + "name": "tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/files/token.jwt", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "560cb7531d1b1033910d828804ef4d7adbd4cef834fcc3d42f79cfef1a5e030b", + "format": 1 + }, + { + "name": "tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/files/jwt_public.pem", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "21d20458029194ee3697de1327a50741ca22801800d48b65d30cfab876b4ef0a", + "format": 1 + }, + { + "name": "tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/handlers", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/handlers/main.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "2a31a8f252b1abff9887b2253289c563fd85d6d13bb8bef0ce621f2d85fa597b", + "format": 1 + }, + { + "name": "tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/templates", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/templates/vault_config.hcl.j2", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "d16ca519b03f5f32d4b4834c77e9906c242797fa4b27ae0a68f885e801f72f1f", + "format": 1 + }, + { + "name": "tests/integration/targets/setup_remote_constraints", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/setup_remote_constraints/aliases", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "b34f7e77b6117dd66a49957c17656b22e5dfa444d8f93af2b4e1d7f1450a5a3d", + "format": 1 + }, + { + "name": "tests/integration/targets/setup_remote_constraints/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/setup_remote_constraints/tasks/main.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "b625673c8e7b2a5dced6117b01aec6f25452246117746bd23450dcf389a61883", + "format": 1 + }, + { + "name": "tests/integration/targets/setup_remote_constraints/meta", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/setup_remote_constraints/meta/main.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "1e8d632f9db7209967c5b2f6d734bede09841acc7b898dafc19f31c72cee9929", + "format": 1 + }, + { + "name": "tests/utils", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/utils/constraints.txt", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "5beb3383ef5546038c2c00ea8e5f438e607d91828ce2259594fd8fbaea003ec9", + "format": 1 + }, + { + "name": "plugins", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/lookup", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/lookup/hashi_vault.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9861c19dc55db2bd54ee86434c8835046ae443d7498dbe8ace751388e72c5927", + "format": 1 + }, + { + "name": "meta", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "meta/runtime.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "df18179bb2f5447a56ac92261a911649b96821c0b2c08eea62d5cc6b0195203f", + "format": 1 + }, + { + "name": ".github", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": ".github/workflows", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": ".github/workflows/ansible-test.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "add910887e6e9e43b63403b7e8e06a911f21e6d4d2d989c245e07bcd32008d36", + "format": 1 + }, + { + "name": ".github/workflows/github-release.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "11ff81dab4a9a892f490362b76e43585d3aedb8342571bc9fa82c40371575cf1", + "format": 1 + }, + { + "name": "LICENSE", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "3972dc9744f6499f0f9b2dbf76696f2ae7ad8af9b23dde66d6af86c9dfb36986", + "format": 1 + }, + { + "name": "CHANGELOG.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "f756a09a988af4f8f54d2880cd062b4abe910d75cb4cd2e728f014953609ac10", + "format": 1 + }, + { + "name": "codecov.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "7a5ac7b92831ac933def0f4c871f83687aaa26a176fb2983d0f58ee2bd07f45a", + "format": 1 + }, + { + "name": "changelogs", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "changelogs/config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "630354cc2146c9705841870850c9a5b3b8f61775452e45f056f3a5f84c6e5f20", + "format": 1 + }, + { + "name": "changelogs/fragments", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "changelogs/fragments/.keep", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "changelogs/changelog.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "8c77e475a56e4a3558551d909e6a94128a73924b11f5ae66460e0050feee70c8", + "format": 1 + } + ], + "format": 1 +}
\ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/community/hashi_vault/LICENSE b/collections-debian-merged/ansible_collections/community/hashi_vault/LICENSE new file mode 100644 index 00000000..f288702d --- /dev/null +++ b/collections-debian-merged/ansible_collections/community/hashi_vault/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + <program> Copyright (C) <year> <name of author> + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +<https://www.gnu.org/licenses/>. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +<https://www.gnu.org/licenses/why-not-lgpl.html>. diff --git a/collections-debian-merged/ansible_collections/community/hashi_vault/MANIFEST.json b/collections-debian-merged/ansible_collections/community/hashi_vault/MANIFEST.json new file mode 100644 index 00000000..d307c7b9 --- /dev/null +++ b/collections-debian-merged/ansible_collections/community/hashi_vault/MANIFEST.json @@ -0,0 +1,36 @@ +{ + "collection_info": { + "namespace": "community", + "name": "hashi_vault", + "version": "1.1.0", + "authors": [ + "Jonathan Davila", + "Brian Scholer (@briantist)" + ], + "readme": "README.md", + "tags": [ + "vault", + "hashicorp", + "secret", + "secrets", + "password", + "passwords" + ], + "description": "Plugins related to HashiCorp Vault", + "license": [], + "license_file": "LICENSE", + "dependencies": {}, + "repository": "https://github.com/ansible-collections/community.hashi_vault", + "documentation": null, + "homepage": "https://github.com/ansible-collections/community.hashi_vault", + "issues": "https://github.com/ansible-collections/community.hashi_vault/issues" + }, + "file_manifest_file": { + "name": "FILES.json", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "f3828c8b9cb4ad390467d31e6d72ee330f62205e7b4ca9d2fda2f0f21c61833d", + "format": 1 + }, + "format": 1 +}
\ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/community/hashi_vault/README.md b/collections-debian-merged/ansible_collections/community/hashi_vault/README.md new file mode 100644 index 00000000..3f7aaaf9 --- /dev/null +++ b/collections-debian-merged/ansible_collections/community/hashi_vault/README.md @@ -0,0 +1,86 @@ +# community.hashi_vault Collection +<!-- Add CI and code coverage badges here. Samples included below. --> +[![CI](https://github.com/ansible-collections/community.hashi_vault/workflows/CI/badge.svg?event=push)](https://github.com/ansible-collections/community.hashi_vault/actions) [![Codecov](https://img.shields.io/codecov/c/github/ansible-collections/community.hashi_vault)](https://codecov.io/gh/ansible-collections/community.hashi_vault) + +<!-- Describe the collection and why a user would want to use it. What does the collection do? --> + +## Tested with Ansible + +<!-- List the versions of Ansible the collection has been tested with. Must match what is in galaxy.yml. --> + +## External requirements + + - `hvac` (python library) + - `hvac` 0.7.0+ (for namespace support) + - `hvac` 0.9.6+ (to avoid all deprecation warnings) + - `hvac` 0.10.5+ (for JWT auth support) + - `botocore` (only if inferring aws params from boto) + - `boto3` (only if using a boto profile) + +## Included content + +- Lookup Plugins + - `hashi_vault` + +## Using this collection + +<!--Include some quick examples that cover the most common use cases for your collection content. --> + +See [Ansible Using collections](https://docs.ansible.com/ansible/latest/user_guide/collections_using.html) for more details. + +## Contributing to this collection + +<!--Describe how the community can contribute to your collection. At a minimum, include how and where users can create issues to report problems or request features for this collection. List contribution requirements, including preferred workflows and necessary testing, so you can benefit from community PRs. If you are following general Ansible contributor guidelines, you can link to - [Ansible Community Guide](https://docs.ansible.com/ansible/latest/community/index.html). --> + + +## Release notes + +See the [changelog](https://github.com/ansible-collections/community.hashi_vault/tree/main/CHANGELOG.rst). + +## FAQ + +### **Q:** Why not have a single collection of HashiCorp products instead of one just for Vault? + +**A:** This was considered when the `hashi_vault` plugin was first moved from `community.general` to this collection. There are several reasons behind this: + +* The other known HashiCorp content at that time (covering Consul, Nomad, Terraform, etc.) does not share implementation or testing with Vault content. +* The maintainers are also different. This being a community supported collection means separate maintainers are more likely to focus on goals that make sense for their particular plugins and user base. +* The HashiCorp products serve different goals, and even when used together, they have their own APIs and interfaces that don't really have anything in common from the point of view of the Ansible codebase as a consumer. +* It would complicate testing. One of the primary goals of moving to a new collection was the ability to increase the scope of Vault-focused testing without having to balance the impact to unrelated components. +* It makes for a smaller package for consumers, that can hopefully release more quickly. + +### **Q:** Why is the collection named `community.hashi_vault` instead of `community.vault` or `community.hashicorp_vault` or `hashicorp.vault` or any number of other names? + +**A:** This too was considered during formation. In the end, `hashi_vault` is a compromise of various concerns. + +* `hashicorp.vault` looks great, but implies the collection is supported by HashiCorp (which it is not). That doesn't follow the convention of denoting community supported namespaces with `community.` +* `community.vault` looks great at first, but "Vault" is a very general and overloaded term, and in Ansible the first "Vault" one thinks of is [Ansible Vault](https://docs.ansible.com/ansible/latest/user_guide/vault.html). So in the naming, and even in the future of this collection and its content, we have to be mindful of avoiding and removing ambiguities between these products (and other Vaults out there). +* `community.hashicorp_vault` is descriptive and unambiguous but is unfortunately quite long. +* `community.hashicorp` would be good for a collection that aims to contain community-supported content related to all HashiCorp products, but this collection is only focused on Vault (see above question). +* `community.hashicorp.vault` (or any other 3-component name): not supported (also long). +* `community.hashi_vault` isn't perfect, but has an established convention in the existing plugin name and isn't as long as `hashicorp_vault`. + + +## Roadmap + +<!-- Optional. Include the roadmap for this collection, and the proposed release/versioning strategy so users can anticipate the upgrade/update cycle. --> + +## More information + +<!-- List out where the user can find additional information, such as working group meeting times, slack/IRC channels, or documentation for the product this collection automates. At a minimum, link to: --> + +- [Ansible Collection overview](https://github.com/ansible-collections/overview) +- [Ansible User guide](https://docs.ansible.com/ansible/latest/user_guide/index.html) +- [Ansible Developer guide](https://docs.ansible.com/ansible/latest/dev_guide/index.html) +- [Ansible Collections Checklist](https://github.com/ansible-collections/overview/blob/master/collection_requirements.rst) +- [Ansible Community code of conduct](https://docs.ansible.com/ansible/latest/community/code_of_conduct.html) +- [The Bullhorn (the Ansible Contributor newsletter)](https://us19.campaign-archive.com/home/?u=56d874e027110e35dea0e03c1&id=d6635f5420) +- [Changes impacting Contributors](https://github.com/ansible-collections/overview/issues/45) + +## Licensing + +<!-- Include the appropriate license information here and a pointer to the full licensing details. If the collection contains modules migrated from the ansible/ansible repo, you must use the same license that existed in the ansible/ansible repo. See the GNU license example below. --> + +GNU General Public License v3.0 or later. + +See [LICENSE](https://www.gnu.org/licenses/gpl-3.0.txt) to see the full text. diff --git a/collections-debian-merged/ansible_collections/community/hashi_vault/changelogs/changelog.yaml b/collections-debian-merged/ansible_collections/community/hashi_vault/changelogs/changelog.yaml new file mode 100644 index 00000000..34da158a --- /dev/null +++ b/collections-debian-merged/ansible_collections/community/hashi_vault/changelogs/changelog.yaml @@ -0,0 +1,96 @@ +ancestor: null +releases: + 0.1.0: + changes: + release_summary: 'Our first release matches the ``hashi_vault`` lookup functionality + provided by ``community.general`` version ``1.3.0``. + +' + fragments: + - 0.1.0.yml + release_date: '2020-12-02' + 0.2.0: + changes: + bugfixes: + - hashi_vault - ``mount_point`` parameter did not work with ``aws_iam_login`` + auth method (https://github.com/ansible-collections/community.hashi_vault/issues/7) + - hashi_vault - fallback logic for handling deprecated style of auth in hvac + was not implemented correctly (https://github.com/ansible-collections/community.hashi_vault/pull/33). + - hashi_vault - parameter ``mount_point`` does not work with JWT auth (https://github.com/ansible-collections/community.hashi_vault/issues/29). + - hashi_vault - tokens without ``lookup-self`` ability can't be used because + of validation (https://github.com/ansible-collections/community.hashi_vault/issues/18). + deprecated_features: + - hashi_vault - ``VAULT_ADDR`` environment variable for option ``url`` will + have its precedence lowered in 1.0.0; use ``ANSIBLE_HASHI_VAULT_ADDR`` to + intentionally override a config value (https://github.com/ansible-collections/community.hashi_vault/issues/8). + - hashi_vault - ``VAULT_AUTH_METHOD`` environment variable for option ``auth_method`` + will be removed in 2.0.0, use ``ANSIBLE_HASHI_VAULT_AUTH_METHOD`` instead + (https://github.com/ansible-collections/community.hashi_vault/issues/17). + - hashi_vault - ``VAULT_ROLE_ID`` environment variable for option ``role_id`` + will be removed in 2.0.0, use ``ANSIBLE_HASHI_VAULT_ROLE_ID`` instead (https://github.com/ansible-collections/community.hashi_vault/issues/20). + - hashi_vault - ``VAULT_SECRET_ID`` environment variable for option ``secret_id`` + will be removed in 2.0.0, use ``ANSIBLE_HASHI_VAULT_SECRET_ID`` instead (https://github.com/ansible-collections/community.hashi_vault/issues/20). + - hashi_vault - ``VAULT_TOKEN_FILE`` environment variable for option ``token_file`` + will be removed in 2.0.0, use ``ANSIBLE_HASHI_VAULT_TOKEN_FILE`` instead (https://github.com/ansible-collections/community.hashi_vault/issues/15). + - hashi_vault - ``VAULT_TOKEN_PATH`` environment variable for option ``token_path`` + will be removed in 2.0.0, use ``ANSIBLE_HASHI_VAULT_TOKEN_PATH`` instead (https://github.com/ansible-collections/community.hashi_vault/issues/15). + minor_changes: + - Add optional ``aws_iam_server_id`` parameter as the value for ``X-Vault-AWS-IAM-Server-ID`` + header (https://github.com/ansible-collections/community.hashi_vault/pull/27). + - hashi_vault - ``ANSIBLE_HASHI_VAULT_ADDR`` environment variable added for + option ``url`` (https://github.com/ansible-collections/community.hashi_vault/issues/8). + - hashi_vault - ``ANSIBLE_HASHI_VAULT_AUTH_METHOD`` environment variable added + for option ``auth_method`` (https://github.com/ansible-collections/community.hashi_vault/issues/17). + - hashi_vault - ``ANSIBLE_HASHI_VAULT_ROLE_ID`` environment variable added for + option ``role_id`` (https://github.com/ansible-collections/community.hashi_vault/issues/20). + - hashi_vault - ``ANSIBLE_HASHI_VAULT_SECRET_ID`` environment variable added + for option ``secret_id`` (https://github.com/ansible-collections/community.hashi_vault/issues/20). + - hashi_vault - ``ANSIBLE_HASHI_VAULT_TOKEN_FILE`` environment variable added + for option ``token_file`` (https://github.com/ansible-collections/community.hashi_vault/issues/15). + - hashi_vault - ``ANSIBLE_HASHI_VAULT_TOKEN_PATH`` environment variable added + for option ``token_path`` (https://github.com/ansible-collections/community.hashi_vault/issues/15). + - hashi_vault - ``namespace`` parameter can be specified in INI or via env vars + ``ANSIBLE_HASHI_VAULT_NAMESPACE`` (new) and ``VAULT_NAMESPACE`` (lower preference) (https://github.com/ansible-collections/community.hashi_vault/issues/14). + - hashi_vault - ``token`` parameter can now be specified via ``ANSIBLE_HASHI_VAULT_TOKEN`` + as well as via ``VAULT_TOKEN`` (the latter with lower preference) (https://github.com/ansible-collections/community.hashi_vault/issues/16). + - hashi_vault - add ``token_validate`` option to control token validation (https://github.com/ansible-collections/community.hashi_vault/pull/24). + - hashi_vault - uses new AppRole method in hvac 0.10.6 with fallback to deprecated + method with warning (https://github.com/ansible-collections/community.hashi_vault/pull/33). + release_summary: 'Several backwards-compatible bugfixes and enhancements in + this release. + + Some environment variables are deprecated and have standardized replacements.' + fragments: + - 0.2.0.yml + - 22-hashi_vault-aws_iam_login-mount_point.yml + - 24-hashi_vault-token_validation.yml + - 25-non-breaking-env-parameter-changes.yml + - 27-add-hashi_vault-header_value-param.yml + - 31-jwt-mount_point.yml + - 33-approle-deprecation.yml + - 35-env-var-deprecations.yml + release_date: '2020-12-24' + 1.0.0: + changes: + breaking_changes: + - hashi_vault - the ``VAULT_ADDR`` environment variable is now checked last + for the ``url`` parameter. For details on which use cases are impacted, see + (https://github.com/ansible-collections/community.hashi_vault/issues/8). + release_summary: Our first major release contains a single breaking change that + will affect only a small subset of users. No functionality is removed. See + the details in the changelog to determine if you're affected and if so how + to transition to remediate. + fragments: + - 1.0.0.yml + - 41-lower-url-env-precedence.yml + release_date: '2020-12-30' + 1.1.0: + changes: + minor_changes: + - hashi_vault - add ``proxies`` option (https://github.com/ansible-collections/community.hashi_vault/pull/50). + release_summary: This release contains a new ``proxies`` option for the ``hashi_vault`` + lookup. + fragments: + - 1.1.0.yml + - 50-add-proxies-option.yml + release_date: '2021-02-08' diff --git a/collections-debian-merged/ansible_collections/community/hashi_vault/changelogs/config.yaml b/collections-debian-merged/ansible_collections/community/hashi_vault/changelogs/config.yaml new file mode 100644 index 00000000..f7f950db --- /dev/null +++ b/collections-debian-merged/ansible_collections/community/hashi_vault/changelogs/config.yaml @@ -0,0 +1,29 @@ +changelog_filename_template: ../CHANGELOG.rst +changelog_filename_version_depth: 0 +changes_file: changelog.yaml +changes_format: combined +keep_fragments: false +mention_ancestor: true +new_plugins_after_name: removed_features +notesdir: fragments +prelude_section_name: release_summary +prelude_section_title: Release Summary +sections: +- - major_changes + - Major Changes +- - minor_changes + - Minor Changes +- - breaking_changes + - Breaking Changes / Porting Guide +- - deprecated_features + - Deprecated Features +- - removed_features + - Removed Features (previously deprecated) +- - security_fixes + - Security Fixes +- - bugfixes + - Bugfixes +- - known_issues + - Known Issues +title: community.hashi_vault +trivial_section_name: trivial diff --git a/collections-debian-merged/ansible_collections/community/hashi_vault/changelogs/fragments/.keep b/collections-debian-merged/ansible_collections/community/hashi_vault/changelogs/fragments/.keep new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/collections-debian-merged/ansible_collections/community/hashi_vault/changelogs/fragments/.keep diff --git a/collections-debian-merged/ansible_collections/community/hashi_vault/codecov.yml b/collections-debian-merged/ansible_collections/community/hashi_vault/codecov.yml new file mode 100644 index 00000000..4a85c562 --- /dev/null +++ b/collections-debian-merged/ansible_collections/community/hashi_vault/codecov.yml @@ -0,0 +1,3 @@ +--- +fixes: + - "ansible_collections/community/hashi_vault/::" diff --git a/collections-debian-merged/ansible_collections/community/hashi_vault/meta/runtime.yml b/collections-debian-merged/ansible_collections/community/hashi_vault/meta/runtime.yml new file mode 100644 index 00000000..2ee3c9fa --- /dev/null +++ b/collections-debian-merged/ansible_collections/community/hashi_vault/meta/runtime.yml @@ -0,0 +1,2 @@ +--- +requires_ansible: '>=2.9.10' diff --git a/collections-debian-merged/ansible_collections/community/hashi_vault/plugins/lookup/hashi_vault.py b/collections-debian-merged/ansible_collections/community/hashi_vault/plugins/lookup/hashi_vault.py new file mode 100644 index 00000000..a00e29ba --- /dev/null +++ b/collections-debian-merged/ansible_collections/community/hashi_vault/plugins/lookup/hashi_vault.py @@ -0,0 +1,876 @@ +# (c) 2020, Brian Scholer (@briantist) +# (c) 2015, Jonathan Davila <jonathan(at)davila.io> +# (c) 2017 Ansible Project +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + +DOCUMENTATION = """ + lookup: hashi_vault + author: + - Jonathan Davila (!UNKNOWN) <jdavila(at)ansible.com> + - Brian Scholer (@briantist) + short_description: Retrieve secrets from HashiCorp's Vault + requirements: + - hvac (python library) + - hvac 0.7.0+ (for namespace support) + - hvac 0.9.6+ (to avoid most deprecation warnings) + - hvac 0.10.5+ (for JWT auth) + - hvac 0.10.6+ (to avoid deprecation warning for AppRole) + - botocore (only if inferring aws params from boto) + - boto3 (only if using a boto profile) + description: + - Retrieve secrets from HashiCorp's Vault. + notes: + - Due to a current limitation in the HVAC library there won't necessarily be an error if a bad endpoint is specified. + - As of community.hashi_vault 0.1.0, only the latest version of a secret is returned when specifying a KV v2 path. + - As of community.hashi_vault 0.1.0, all options can be supplied via term string (space delimited key=value pairs) or by parameters (see examples). + - As of community.hashi_vault 0.1.0, when I(secret) is the first option in the term string, C(secret=) is not required (see examples). + options: + secret: + description: Vault path to the secret being requested in the format C(path[:field]). + required: True + token: + description: + - Vault token. Token may be specified explicitly, through the listed env var, and also through the C(VAULT_TOKEN) env var. + - If no token is supplied, explicitly or through env, then the plugin will check for a token file, as determined by I(token_path) and I(token_file). + - The order of token loading (first found wins) is C(token param -> ANSIBLE_HASHI_VAULT_TOKEN -> VAULT_TOKEN -> token file). + env: + - name: ANSIBLE_HASHI_VAULT_TOKEN + version_added: '0.2.0' + token_path: + description: If no token is specified, will try to read the I(token_file) from this path. + env: + - name: VAULT_TOKEN_PATH + deprecated: + why: standardizing environment variables + version: 2.0.0 + collection_name: community.hashi_vault + alternatives: ANSIBLE_HASHI_VAULT_TOKEN_PATH + - name: ANSIBLE_HASHI_VAULT_TOKEN_PATH + version_added: '0.2.0' + ini: + - section: lookup_hashi_vault + key: token_path + token_file: + description: If no token is specified, will try to read the token from this file in I(token_path). + env: + - name: VAULT_TOKEN_FILE + deprecated: + why: standardizing environment variables + version: 2.0.0 + collection_name: community.hashi_vault + alternatives: ANSIBLE_HASHI_VAULT_TOKEN_FILE + - name: ANSIBLE_HASHI_VAULT_TOKEN_FILE + version_added: '0.2.0' + ini: + - section: lookup_hashi_vault + key: token_file + default: '.vault-token' + token_validate: + description: + - For token auth, will perform a C(lookup-self) operation to determine the token's validity before using it. + - Disable if your token doesn't have the C(lookup-self) capability. + env: + - name: ANSIBLE_HASHI_VAULT_TOKEN_VALIDATE + ini: + - section: lookup_hashi_vault + key: token_validate + type: boolean + default: true + version_added: 0.2.0 + url: + description: + - URL to the Vault service. + - If not specified by any other means, the value of the C(VAULT_ADDR) environment variable will be used. + env: + - name: ANSIBLE_HASHI_VAULT_ADDR + version_added: '0.2.0' + ini: + - section: lookup_hashi_vault + key: url + default: 'http://127.0.0.1:8200' + username: + description: Authentication user name. + password: + description: Authentication password. + proxies: + description: + - URL(s) to the proxies used to access the Vault service. + - It can be a string or a dict. + - If it's a dict, provide the scheme (eg. C(http) or C(https)) as the key, and the URL as the value. + - If it's a string, provide a single URL that will be used as the proxy for both C(http) and C(https) schemes. + - A string that can be interpreted as a dictionary will be converted to one (see examples). + - You can specify a different proxy for HTTP and HTTPS resources. + - If not specified, L(environment variables from the Requests library,https://requests.readthedocs.io/en/master/user/advanced/#proxies) are used. + env: + - name: ANSIBLE_HASHI_VAULT_PROXIES + ini: + - section: lookup_hashi_vault + key: proxies + type: raw + version_added: '1.1.0' + role_id: + description: Vault Role ID. Used in approle and aws_iam_login auth methods. + env: + - name: VAULT_ROLE_ID + deprecated: + why: standardizing environment variables + version: 2.0.0 + collection_name: community.hashi_vault + alternatives: ANSIBLE_HASHI_VAULT_ROLE_ID + - name: ANSIBLE_HASHI_VAULT_ROLE_ID + version_added: '0.2.0' + ini: + - section: lookup_hashi_vault + key: role_id + secret_id: + description: Secret ID to be used for Vault AppRole authentication. + env: + - name: VAULT_SECRET_ID + deprecated: + why: standardizing environment variables + version: 2.0.0 + collection_name: community.hashi_vault + alternatives: ANSIBLE_HASHI_VAULT_SECRET_ID + - name: ANSIBLE_HASHI_VAULT_SECRET_ID + version_added: '0.2.0' + auth_method: + description: + - Authentication method to be used. + env: + - name: VAULT_AUTH_METHOD + deprecated: + why: standardizing environment variables + version: 2.0.0 + collection_name: community.hashi_vault + alternatives: ANSIBLE_HASHI_VAULT_AUTH_METHOD + - name: ANSIBLE_HASHI_VAULT_AUTH_METHOD + version_added: '0.2.0' + ini: + - section: lookup_hashi_vault + key: auth_method + choices: + - token + - userpass + - ldap + - approle + - aws_iam_login + - jwt + default: token + return_format: + description: + - Controls how multiple key/value pairs in a path are treated on return. + - C(dict) returns a single dict containing the key/value pairs. + - C(values) returns a list of all the values only. Use when you don't care about the keys. + - C(raw) returns the actual API result (deserialized), which includes metadata and may have the data nested in other keys. + choices: + - dict + - values + - raw + default: dict + aliases: [ as ] + mount_point: + description: + - Vault mount point. + - If not specified, the default mount point for a given auth method is used. + - Does not apply to token authentication. + jwt: + description: The JSON Web Token (JWT) to use for JWT authentication to Vault. + env: + - name: ANSIBLE_HASHI_VAULT_JWT + ca_cert: + description: Path to certificate to use for authentication. + aliases: [ cacert ] + validate_certs: + description: + - Controls verification and validation of SSL certificates, mostly you only want to turn off with self signed ones. + - Will be populated with the inverse of C(VAULT_SKIP_VERIFY) if that is set and I(validate_certs) is not explicitly provided. + - Will default to C(true) if neither I(validate_certs) or C(VAULT_SKIP_VERIFY) are set. + type: boolean + namespace: + description: + - Vault namespace where secrets reside. This option requires HVAC 0.7.0+ and Vault 0.11+. + - Optionally, this may be achieved by prefixing the authentication mount point and/or secret path with the namespace + (e.g C(mynamespace/secret/mysecret)). + - If environment variable C(VAULT_NAMESPACE) is set, its value will be used last among all ways to specify I(namespace). + env: + - name: ANSIBLE_HASHI_VAULT_NAMESPACE + version_added: '0.2.0' + ini: + - section: lookup_hashi_vault + key: namespace + version_added: '0.2.0' + aws_profile: + description: The AWS profile + type: str + aliases: [ boto_profile ] + env: + - name: AWS_DEFAULT_PROFILE + - name: AWS_PROFILE + aws_access_key: + description: The AWS access key to use. + type: str + aliases: [ aws_access_key_id ] + env: + - name: EC2_ACCESS_KEY + - name: AWS_ACCESS_KEY + - name: AWS_ACCESS_KEY_ID + aws_secret_key: + description: The AWS secret key that corresponds to the access key. + type: str + aliases: [ aws_secret_access_key ] + env: + - name: EC2_SECRET_KEY + - name: AWS_SECRET_KEY + - name: AWS_SECRET_ACCESS_KEY + aws_security_token: + description: The AWS security token if using temporary access and secret keys. + type: str + env: + - name: EC2_SECURITY_TOKEN + - name: AWS_SESSION_TOKEN + - name: AWS_SECURITY_TOKEN + region: + description: The AWS region for which to create the connection. + type: str + env: + - name: EC2_REGION + - name: AWS_REGION + aws_iam_server_id: + description: If specified, sets the value to use for the C(X-Vault-AWS-IAM-Server-ID) header as part of C(GetCallerIdentity) request. + env: + - name: ANSIBLE_HASHI_VAULT_AWS_IAM_SERVER_ID + ini: + - section: lookup_hashi_vault + key: aws_iam_server_id + required: False + version_added: '0.2.0' +""" + +EXAMPLES = """ +- ansible.builtin.debug: + msg: "{{ lookup('community.hashi_vault.hashi_vault', 'secret=secret/hello:value token=c975b780-d1be-8016-866b-01d0f9b688a5 url=http://myvault:8200') }}" + +- name: Return all secrets from a path + ansible.builtin.debug: + msg: "{{ lookup('community.hashi_vault.hashi_vault', 'secret=secret/hello token=c975b780-d1be-8016-866b-01d0f9b688a5 url=http://myvault:8200') }}" + +- name: Vault that requires authentication via LDAP + ansible.builtin.debug: + msg: "{{ lookup('community.hashi_vault.hashi_vault', 'secret/hello:value auth_method=ldap mount_point=ldap username=myuser password=mypas') }}" + +- name: Vault that requires authentication via username and password + ansible.builtin.debug: + msg: "{{ lookup('community.hashi_vault.hashi_vault', 'secret=secret/hola:val auth_method=userpass username=myuser password=psw url=http://vault:8200') }}" + +- name: Connect to Vault using TLS + ansible.builtin.debug: + msg: "{{ lookup('community.hashi_vault.hashi_vault', 'secret=secret/hola:value token=c975b780-d1be-8016-866b-01d0f9b688a5 validate_certs=False') }}" + +- name: using certificate auth + ansible.builtin.debug: + msg: "{{ lookup('community.hashi_vault.hashi_vault', 'secret/hi:val token=xxxx url=https://vault:8200 validate_certs=True cacert=/cacert/path/ca.pem') }}" + +- name: Authenticate with a Vault app role + ansible.builtin.debug: + msg: "{{ lookup('community.hashi_vault.hashi_vault', 'secret=secret/hello:value auth_method=approle role_id=myroleid secret_id=mysecretid') }}" + +- name: Return all secrets from a path in a namespace + ansible.builtin.debug: + msg: "{{ lookup('community.hashi_vault.hashi_vault', 'secret=secret/hello token=c975b780-d1be-8016-866b-01d0f9b688a5 namespace=teama/admins') }}" + +# When using KV v2 the PATH should include "data" between the secret engine mount and path (e.g. "secret/data/:path") +# see: https://www.vaultproject.io/api/secret/kv/kv-v2.html#read-secret-version +- name: Return latest KV v2 secret from path + ansible.builtin.debug: + msg: "{{ lookup('community.hashi_vault.hashi_vault', 'secret=secret/data/hello token=my_vault_token url=http://myvault_url:8200') }}" + +# The following examples show more modern syntax, with parameters specified separately from the term string. + +- name: secret= is not required if secret is first + ansible.builtin.debug: + msg: "{{ lookup('community.hashi_vault.hashi_vault', 'secret/data/hello token=<token> url=http://myvault_url:8200') }}" + +- name: options can be specified as parameters rather than put in term string + ansible.builtin.debug: + msg: "{{ lookup('community.hashi_vault.hashi_vault', 'secret/data/hello', token=my_token_var, url='http://myvault_url:8200') }}" + +# return_format (or its alias 'as') can control how secrets are returned to you +- name: return secrets as a dict (default) + ansible.builtin.set_fact: + my_secrets: "{{ lookup('community.hashi_vault.hashi_vault', 'secret/data/manysecrets', token=my_token_var, url='http://myvault_url:8200') }}" +- ansible.builtin.debug: + msg: "{{ my_secrets['secret_key'] }}" +- ansible.builtin.debug: + msg: "Secret '{{ item.key }}' has value '{{ item.value }}'" + loop: "{{ my_secrets | dict2items }}" + +- name: return secrets as values only + ansible.builtin.debug: + msg: "A secret value: {{ item }}" + loop: "{{ query('community.hashi_vault.hashi_vault', 'secret/data/manysecrets', token=my_token_var, url='http://vault_url:8200', return_format='values') }}" + +- name: return raw secret from API, including metadata + ansible.builtin.set_fact: + my_secret: "{{ lookup('community.hashi_vault.hashi_vault', 'secret/data/hello:value', token=my_token_var, url='http://myvault_url:8200', as='raw') }}" +- ansible.builtin.debug: + msg: "This is version {{ my_secret['metadata']['version'] }} of hello:value. The secret data is {{ my_secret['data']['data']['value'] }}" + +# AWS IAM authentication method +# uses Ansible standard AWS options + +- name: authenticate with aws_iam_login + ansible.builtin.debug: + msg: "{{ lookup('community.hashi_vault.hashi_vault', 'secret/hello:value', auth_method='aws_iam_login', role_id='myroleid', profile=my_boto_profile) }}" + +# JWT auth + +- name: Authenticate with a JWT + ansible.builtin.debug: + msg: "{{ lookup('community.hashi_vault.hashi_vault', 'secret/hola:val', auth_method='jwt', role_id='myroleid', jwt='myjwt', url='https://vault:8200') }}" + +# Disabling Token Validation +# Use this when your token does not have the lookup-self capability. Usually this is applied to all tokens via the default policy. +# However you can choose to create tokens without applying the default policy, or you can modify your default policy not to include it. +# When disabled, your invalid or expired token will be indistinguishable from insufficent permissions. + +- name: authenticate without token validation + ansible.builtin.debug: + msg: "{{ lookup('community.hashi_vault.hashi_vault', 'secret/hello:value', token=my_token, token_validate=False) }}" + +# Use a proxy + +- name: use a proxy with login/password + ansible.builtin.debug: + msg: "{{ lookup('community.hashi_vault.hashi_vault', 'secret=... token=... url=https://... proxies=https://user:pass@myproxy:8080') }}" + +- name: 'use a socks proxy (need some additional dependencies, see: https://requests.readthedocs.io/en/master/user/advanced/#socks )' + ansible.builtin.debug: + msg: "{{ lookup('community.hashi_vault.hashi_vault', 'secret=... token=... url=https://... proxies=socks5://myproxy:1080') }}" + +- name: use proxies with a dict (as param) + ansible.builtin.debug: + msg: "{{ lookup('community.hashi_vault.hashi_vault', '...', proxies={'http': 'http://myproxy1', 'https': 'http://myproxy2'}) }}" + +- name: use proxies with a dict (as param, pre-defined var) + vars: + prox: + http: http://myproxy1 + https: https://myproxy2 + ansible.builtin.debug: + msg: "{{ lookup('community.hashi_vault.hashi_vault', '...', proxies=prox }}" + +- name: use proxies with a dict (in the term string, Ansible key=value syntax) + ansible.builtin.debug: + msg: "{{ lookup('community.hashi_vault.hashi_vault', '... proxies=http=http://myproxy1,https=http://myproxy2') }}" + +- name: use proxies with a dict (in the term string, JSON syntax) + ansible.builtin.debug: + msg: "{{ lookup('community.hashi_vault.hashi_vault', '... proxies={\\"http\\":\\"http://myproxy1\\",\\"https\\":\\"http://myproxy2\\"}') }}" +""" + +RETURN = """ +_raw: + description: + - secrets(s) requested + type: list + elements: dict +""" + +import os + +from ansible.errors import AnsibleError +from ansible.plugins.lookup import LookupBase +from ansible.module_utils.parsing.convert_bool import boolean +from ansible import constants as C +from ansible.utils.display import Display +from ansible.module_utils.common.validation import check_type_dict, check_type_str + +display = Display() + +HAS_HVAC = False +try: + import hvac + HAS_HVAC = True +except ImportError: + HAS_HVAC = False + +HAS_BOTOCORE = False +try: + # import boto3 + import botocore + HAS_BOTOCORE = True +except ImportError: + HAS_BOTOCORE = False + +HAS_BOTO3 = False +try: + import boto3 + # import botocore + HAS_BOTO3 = True +except ImportError: + HAS_BOTO3 = False + +# see https://github.com/ansible-collections/community.hashi_vault/issues/10 +# +# Options which seek to use environment vars that are not Ansible-specific +# should load those as values of last resort, so that INI values can override them. +# For default processing, list such options and vars here. +# Alternatively, process them in another appropriate place like an auth method's +# validate_ method. +# +# key = option_name +# value = list of env vars (in order of those checked first; process stops when value is found) +LOW_PRECEDENCE_ENV_VAR_OPTIONS = { + 'token_path': ['HOME'], + 'namespace': ['VAULT_NAMESPACE'], + 'token': ['VAULT_TOKEN'], + 'url': ['VAULT_ADDR'], +} + + +# TODO: this is a workaround for deprecations not being shown in lookups +# See: https://github.com/ansible/ansible/issues/73051 +# Fix: https://github.com/ansible/ansible/pull/73058 +# +# If #73058 or another fix is backported, this should be removed. +def deprecate(collection_name='community.hashi_vault'): + + # nicked from cli/__init__.py + # with slight customizations to help filter out relevant messages + # (relying on the collection name since it's a valid attrib and we only have 1 plugin at this time) + + # warn about deprecated config options + + for deprecated in list(C.config.DEPRECATED): + name = deprecated[0] + why = deprecated[1]['why'] + if deprecated[1].get('collection_name') != collection_name: + continue + + if 'alternatives' in deprecated[1]: + alt = ', use %s instead' % deprecated[1]['alternatives'] + else: + alt = '' + ver = deprecated[1].get('version') + date = deprecated[1].get('date') + collection_name = deprecated[1].get('collection_name') + display.deprecated("%s option, %s%s" % (name, why, alt), version=ver, date=date, collection_name=collection_name) + + # remove this item from the list so it won't get processed again by something else + C.config.DEPRECATED.remove(deprecated) + + +class HashiVault: + def get_options(self, *option_names, **kwargs): + ret = {} + include_falsey = kwargs.get('include_falsey', False) + for option in option_names: + val = self.options.get(option) + if val or include_falsey: + ret[option] = val + return ret + + def __init__(self, **kwargs): + self.options = kwargs + + # check early that auth method is actually available + self.auth_function = 'auth_' + self.options['auth_method'] + if not (hasattr(self, self.auth_function) and callable(getattr(self, self.auth_function))): + raise AnsibleError( + "Authentication method '%s' is not implemented. ('%s' member function not found)" % (self.options['auth_method'], self.auth_function) + ) + + client_args = { + 'url': self.options['url'], + 'verify': self.options['ca_cert'] + } + + if self.options.get('namespace'): + client_args['namespace'] = self.options['namespace'] + + # this is the only auth_method-specific thing here, because if we're using a token, we need it now + if self.options['auth_method'] == 'token': + client_args['token'] = self.options.get('token') + + if self.options.get('proxies') is not None: + client_args['proxies'] = self.options.get('proxies') + + self.client = hvac.Client(**client_args) + # logout to prevent accidental use of inferred tokens + # https://github.com/ansible-collections/community.hashi_vault/issues/13 + if 'token' not in client_args: + self.client.logout() + + # Check for old version, before auth_methods class (added in 0.7.0): + # https://github.com/hvac/hvac/releases/tag/v0.7.0 + # + # hvac is moving auth methods into the auth_methods class + # which lives in the client.auth member. + # + # Attempting to find which backends were moved into the class when (this is primarily for warnings): + # 0.7.0 -- github, ldap, mfa, azure?, gcp + # 0.7.1 -- okta + # 0.8.0 -- kubernetes + # 0.9.0 -- azure?, radius + # 0.9.3 -- aws + # 0.9.6 -- userpass + # 0.10.5 -- jwt (new) + self.hvac_has_auth_methods = hasattr(self.client, 'auth') + + # We've already checked to ensure a method exists for a particular auth_method, of the form: + # + # auth_<method_name> + # + def authenticate(self): + getattr(self, self.auth_function)() + + def get(self): + '''gets a secret. should always return a list''' + secret = self.options['secret'] + field = self.options['secret_field'] + return_as = self.options['return_format'] + + try: + data = self.client.read(secret) + except hvac.exceptions.Forbidden: + raise AnsibleError("Forbidden: Permission Denied to secret '%s'." % secret) + + if data is None: + raise AnsibleError("The secret '%s' doesn't seem to exist." % secret) + + if return_as == 'raw': + return [data] + + # Check response for KV v2 fields and flatten nested secret data. + # https://vaultproject.io/api/secret/kv/kv-v2.html#sample-response-1 + try: + # sentinel field checks + check_dd = data['data']['data'] + check_md = data['data']['metadata'] + # unwrap nested data + data = data['data'] + except KeyError: + pass + + if return_as == 'values': + return list(data['data'].values()) + + # everything after here implements return_as == 'dict' + if not field: + return [data['data']] + + if field not in data['data']: + raise AnsibleError("The secret %s does not contain the field '%s'. for hashi_vault lookup" % (secret, field)) + + return [data['data'][field]] + + # begin auth implementation methods + # + # To add new backends, 3 things should be added: + # + # 1. Add a new validate_auth_<method_name> method to the LookupModule, which is responsible for validating + # that it has the necessary options and whatever else it needs. + # + # 2. Add a new auth_<method_name> method to this class. These implementations are faily minimal as they should + # already have everything they need. This is also the place to check for deprecated auth methods as hvac + # continues to move backends into the auth_methods class. + # + # 3. Update the avail_auth_methods list in the LookupModule's auth_methods() method (for now this is static). + # + def auth_token(self): + if self.options.get('token_validate') and not self.client.is_authenticated(): + raise AnsibleError("Invalid Hashicorp Vault Token Specified for hashi_vault lookup.") + + def auth_userpass(self): + params = self.get_options('username', 'password', 'mount_point') + try: + self.client.auth.userpass.login(**params) + except (NotImplementedError, AttributeError): + display.warning("HVAC should be updated to version 0.9.6 or higher. Deprecated method 'auth_userpass' will be used.") + self.client.auth_userpass(**params) + + def auth_ldap(self): + params = self.get_options('username', 'password', 'mount_point') + try: + self.client.auth.ldap.login(**params) + except (NotImplementedError, AttributeError): + display.warning("HVAC should be updated to version 0.7.0 or higher. Deprecated method 'auth_ldap' will be used.") + self.client.auth_ldap(**params) + + def auth_approle(self): + params = self.get_options('role_id', 'secret_id', 'mount_point') + try: + self.client.auth.approle.login(**params) + except (NotImplementedError, AttributeError): + display.warning("HVAC should be updated to version 0.10.6 or higher. Deprecated method 'auth_approle' will be used.") + self.client.auth_approle(**params) + + def auth_aws_iam_login(self): + params = self.options['_auth_aws_iam_login_params'] + try: + self.client.auth.aws.iam_login(**params) + except (NotImplementedError, AttributeError): + display.warning("HVAC should be updated to version 0.9.3 or higher. Deprecated method 'auth_aws_iam' will be used.") + self.client.auth_aws_iam(**params) + + def auth_jwt(self): + params = self.get_options('role_id', 'jwt', 'mount_point') + params['role'] = params.pop('role_id') + + if 'mount_point' in params: + params['path'] = params.pop('mount_point') + + try: + response = self.client.auth.jwt.jwt_login(**params) + # must manually set the client token with JWT login + # see https://github.com/hvac/hvac/issues/644 + self.client.token = response['auth']['client_token'] + except (NotImplementedError, AttributeError): + raise AnsibleError("JWT authentication requires HVAC version 0.10.5 or higher.") + + # end auth implementation methods + + +class LookupModule(LookupBase): + def run(self, terms, variables=None, **kwargs): + if not HAS_HVAC: + raise AnsibleError("Please pip install hvac to use the hashi_vault lookup module.") + + ret = [] + + for term in terms: + opts = kwargs.copy() + opts.update(self.parse_term(term)) + self.set_options(direct=opts) + # TODO: remove deprecate() if backported fix is available (see method definition) + deprecate() + self.process_options() + # FUTURE: Create one object, authenticate once, and re-use it, + # for gets, for better use during with_ loops. + client = HashiVault(**self._options) + client.authenticate() + ret.extend(client.get()) + + return ret + + def parse_term(self, term): + '''parses a term string into options''' + param_dict = {} + + for i, param in enumerate(term.split()): + try: + key, value = param.split('=', 1) + except ValueError: + if (i == 0): + # allow secret to be specified as value only if it's first + key = 'secret' + value = param + else: + raise AnsibleError("hashi_vault lookup plugin needs key=value pairs, but received %s" % term) + param_dict[key] = value + return param_dict + + def process_options(self): + '''performs deep validation and value loading for options''' + + # low preference env vars + self.low_preference_env_vars() + + # ca_cert to verify + self.boolean_or_cacert() + + # auth methods + self.auth_methods() + + # secret field splitter + self.field_ops() + + # proxies (dict or str) + self.process_option_proxies() + + # begin options processing methods + + def set_default_option_env(self, option, var): + '''sets an option to the value of an env var if None''' + if self.get_option(option) is None: + self.set_option(option, os.environ.get(var)) + + def low_preference_env_vars(self): + '''sets all options that have a low preference env var''' + # see definition of LOW_PRECEDENCE_ENV_VAR_OPTIONS near the top of the file + for opt, envs in LOW_PRECEDENCE_ENV_VAR_OPTIONS.items(): + for env in envs: + self.set_default_option_env(opt, env) + + def boolean_or_cacert(self): + # This is needed because of this (https://hvac.readthedocs.io/en/stable/source/hvac_v1.html): + # + # # verify (Union[bool,str]) - Either a boolean to indicate whether TLS verification should + # # be performed when sending requests to Vault, or a string pointing at the CA bundle to use for verification. + # + '''return a bool or cacert''' + ca_cert = self.get_option('ca_cert') + + validate_certs = self.get_option('validate_certs') + + if validate_certs is None: + # Validate certs option was not explicitly set + + # Check if VAULT_SKIP_VERIFY is set + vault_skip_verify = os.environ.get('VAULT_SKIP_VERIFY') + + if vault_skip_verify is not None: + # VAULT_SKIP_VERIFY is set + try: + # Check that we have a boolean value + vault_skip_verify = boolean(vault_skip_verify) + # Use the inverse of VAULT_SKIP_VERIFY + validate_certs = not vault_skip_verify + except TypeError: + # Not a boolean value fallback to default value (True) + validate_certs = True + else: + validate_certs = True + + if not (validate_certs and ca_cert): + self.set_option('ca_cert', validate_certs) + + def field_ops(self): + # split secret and field + secret = self.get_option('secret') + + s_f = secret.rsplit(':', 1) + self.set_option('secret', s_f[0]) + if len(s_f) >= 2: + field = s_f[1] + else: + field = None + self.set_option('secret_field', field) + + def auth_methods(self): + # enforce and set the list of available auth methods + # TODO: can this be read from the choices: field in documentation? + avail_auth_methods = ['token', 'approle', 'userpass', 'ldap', 'aws_iam_login', 'jwt'] + self.set_option('avail_auth_methods', avail_auth_methods) + auth_method = self.get_option('auth_method') + + if auth_method not in avail_auth_methods: + raise AnsibleError( + "Authentication method '%s' not supported. Available options are %r" % (auth_method, avail_auth_methods) + ) + + # run validator if available + auth_validator = 'validate_auth_' + auth_method + if hasattr(self, auth_validator) and callable(getattr(self, auth_validator)): + getattr(self, auth_validator)(auth_method) + + def process_option_proxies(self): + # check if 'proxies' option is dict or str + + proxies_opt = self.get_option('proxies') + + if proxies_opt is None: + return + + try: + # if it can be interpreted as dict + # do it + proxies = check_type_dict(proxies_opt) + except TypeError: + # if it can't be interpreted as dict + proxy = check_type_str(proxies_opt) + # but can be interpreted as str + # use this str as http and https proxy + proxies = { + 'http': proxy, + 'https': proxy + } + + # record the new/interpreted value for 'proxies' option + self.set_option('proxies', proxies) + + # end options processing methods + + # begin auth method validators + + def validate_by_required_fields(self, auth_method, *field_names): + missing = [field for field in field_names if not self.get_option(field)] + + if missing: + raise AnsibleError("Authentication method %s requires options %r to be set, but these are missing: %r" % (auth_method, field_names, missing)) + + def validate_auth_userpass(self, auth_method): + self.validate_by_required_fields(auth_method, 'username', 'password') + + def validate_auth_ldap(self, auth_method): + self.validate_by_required_fields(auth_method, 'username', 'password') + + def validate_auth_approle(self, auth_method): + self.validate_by_required_fields(auth_method, 'role_id') + + # This lone superfluous get_option() is intentional, see: + # https://github.com/ansible-collections/community.hashi_vault/issues/35 + self.get_option('secret_id') + + def validate_auth_token(self, auth_method): + if auth_method == 'token': + if not self.get_option('token') and self.get_option('token_path'): + token_filename = os.path.join( + self.get_option('token_path'), + self.get_option('token_file') + ) + if os.path.exists(token_filename): + with open(token_filename) as token_file: + self.set_option('token', token_file.read().strip()) + + if not self.get_option('token'): + raise AnsibleError("No Vault Token specified or discovered.") + + def validate_auth_aws_iam_login(self, auth_method): + params = { + 'access_key': self.get_option('aws_access_key'), + 'secret_key': self.get_option('aws_secret_key'), + } + + if self.get_option('mount_point'): + params['mount_point'] = self.get_option('mount_point') + + if self.get_option('role_id'): + params['role'] = self.get_option('role_id') + + if self.get_option('region'): + params['region'] = self.get_option('region') + + if self.get_option('aws_iam_server_id'): + params['header_value'] = self.get_option('aws_iam_server_id') + + if not (params['access_key'] and params['secret_key']): + profile = self.get_option('aws_profile') + if profile: + # try to load boto profile + if not HAS_BOTO3: + raise AnsibleError("boto3 is required for loading a boto profile.") + session_credentials = boto3.session.Session(profile_name=profile).get_credentials() + else: + # try to load from IAM credentials + if not HAS_BOTOCORE: + raise AnsibleError("botocore is required for loading IAM role credentials.") + session_credentials = botocore.session.get_session().get_credentials() + + if not session_credentials: + raise AnsibleError("No AWS credentials supplied or available.") + + params['access_key'] = session_credentials.access_key + params['secret_key'] = session_credentials.secret_key + if session_credentials.token: + params['session_token'] = session_credentials.token + + self.set_option('_auth_aws_iam_login_params', params) + + def validate_auth_jwt(self, auth_method): + self.validate_by_required_fields(auth_method, 'role_id', 'jwt') + + # end auth method validators diff --git a/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/aliases b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/aliases new file mode 100644 index 00000000..c8dd0355 --- /dev/null +++ b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/aliases @@ -0,0 +1,6 @@ +shippable/posix/group2 +destructive +needs/file/tests/utils/constraints.txt +skip/aix +skip/python2.6 # lookups are controller only, and we no longer support Python 2.6 on the controller +skip/macos # FIXME seems to be always unstable diff --git a/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/defaults/main.yml b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/defaults/main.yml new file mode 100644 index 00000000..07d81ea1 --- /dev/null +++ b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/defaults/main.yml @@ -0,0 +1,93 @@ +--- +vault_gen_path: 'gen/testproject' +vault_kv1_path: 'kv1/testproject' +vault_kv2_path: 'kv2/data/testproject' +vault_kv2_multi_path: 'kv2/data/testmulti' + +vault_base_policy: | + path "{{ vault_gen_path }}/secret1" { + capabilities = ["read"] + } + path "{{ vault_gen_path }}/secret2" { + capabilities = ["read", "update"] + } + path "{{ vault_gen_path }}/secret3" { + capabilities = ["deny"] + } + path "{{ vault_kv1_path }}/secret1" { + capabilities = ["read"] + } + path "{{ vault_kv1_path }}/secret2" { + capabilities = ["read", "update"] + } + path "{{ vault_kv1_path }}/secret3" { + capabilities = ["deny"] + } + path "{{ vault_kv2_path }}/secret1" { + capabilities = ["read"] + } + path "{{ vault_kv2_path }}/secret2" { + capabilities = ["read", "update"] + } + path "{{ vault_kv2_path }}/secret3" { + capabilities = ["deny"] + } + path "{{ vault_kv2_multi_path }}/secrets" { + capabilities = ["read"] + } + path "{{ vault_kv2_path }}/secret4" { + capabilities = ["read", "update"] + } + +# the purpose of these policies is to catch when the plugin accepts mount_point but does not pass +# it into hvac. we set the test policy to deny access to this secret and the alt policy to read it +# the test-policy is assigned to the default mount of the auth method, while the alt policy is +# assigned to the alternate (non-default) mount +vault_test_policy: | + {{ vault_base_policy }} + path "{{ vault_kv2_path }}/secret5" { + capabilities = ["deny"] + } + +vault_alt_policy: | + {{ vault_base_policy }} + path "{{ vault_kv2_path }}/secret5" { + capabilities = ["read"] + } + + +## auth method params +auth_methods: + jwt: + default_path: jwt + paths: + - jwt + - jwt-alt + aws_iam_login: + default_path: aws + paths: + - aws-alt + - aws + approle: + default_path: approle + paths: + - approle + - approle-alt + + + +## vars for vault server + +vault_ansible_arch_table: + 'x86_64': 'amd64' # Linux + 'amd64': 'amd64' # FreeBSD + 'i386': '386' + +vault_arch: "{{ vault_ansible_arch_table[ansible_architecture] }}" + +vault_version: '1.6.0' +vault_bin: '{{ role_path }}/files/bin/{{ vault_slug }}' +vault_slug: 'vault_{{ vault_version }}_{{ ansible_system | lower }}_{{ vault_arch }}' +vault_zip: '{{ vault_bin }}/{{ vault_slug }}.zip' +vault_uri: 'https://releases.hashicorp.com/vault/{{ vault_version }}/{{ vault_slug }}.zip' +vault_cmd: '{{ vault_bin }}/vault' diff --git a/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/files/bin/.gitignore b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/files/bin/.gitignore new file mode 100644 index 00000000..7c9d611b --- /dev/null +++ b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/files/bin/.gitignore @@ -0,0 +1,3 @@ +* +!.gitignore +!README.md diff --git a/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/files/jwt_private.pem b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/files/jwt_private.pem new file mode 100644 index 00000000..61056a54 --- /dev/null +++ b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/files/jwt_private.pem @@ -0,0 +1,27 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIEogIBAAKCAQEAnzyis1ZjfNB0bBgKFMSvvkTtwlvBsaJq7S5wA+kzeVOVpVWw +kWdVha4s38XM/pa/yr47av7+z3VTmvDRyAHcaT92whREFpLv9cj5lTeJSibyr/Mr +m/YtjCZVWgaOYIhwrXwKLqPr/11inWsAkfIytvHWTxZYEcXLgAXFuUuaS3uF9gEi +NQwzGTU1v0FqkqTBr4B8nW3HCN47XUu0t8Y0e+lf4s4OxQawWD79J9/5d3Ry0vbV +3Am1FtGJiJvOwRsIfVChDpYStTcHTCMqtvWbV6L11BWkpzGXSW4Hv43qa+GSYOD2 +QU68Mb59oSk2OB+BtOLpJofmbGEGgvmwyCI9MwIDAQABAoIBACiARq2wkltjtcjs +kFvZ7w1JAORHbEufEO1Eu27zOIlqbgyAcAl7q+/1bip4Z/x1IVES84/yTaM8p0go +amMhvgry/mS8vNi1BN2SAZEnb/7xSxbflb70bX9RHLJqKnp5GZe2jexw+wyXlwaM ++bclUCrh9e1ltH7IvUrRrQnFJfh+is1fRon9Co9Li0GwoN0x0byrrngU8Ak3Y6D9 +D8GjQA4Elm94ST3izJv8iCOLSDBmzsPsXfcCUZfmTfZ5DbUDMbMxRnSo3nQeoKGC +0Lj9FkWcfmLcpGlSXTO+Ww1L7EGq+PT3NtRae1FZPwjddQ1/4V905kyQFLamAA5Y +lSpE2wkCgYEAy1OPLQcZt4NQnQzPz2SBJqQN2P5u3vXl+zNVKP8w4eBv0vWuJJF+ +hkGNnSxXQrTkvDOIUddSKOzHHgSg4nY6K02ecyT0PPm/UZvtRpWrnBjcEVtHEJNp +bU9pLD5iZ0J9sbzPU/LxPmuAP2Bs8JmTn6aFRspFrP7W0s1Nmk2jsm0CgYEAyH0X ++jpoqxj4efZfkUrg5GbSEhf+dZglf0tTOA5bVg8IYwtmNk/pniLG/zI7c+GlTc9B +BwfMr59EzBq/eFMI7+LgXaVUsM/sS4Ry+yeK6SJx/otIMWtDfqxsLD8CPMCRvecC +2Pip4uSgrl0MOebl9XKp57GoaUWRWRHqwV4Y6h8CgYAZhI4mh4qZtnhKjY4TKDjx +QYufXSdLAi9v3FxmvchDwOgn4L+PRVdMwDNms2bsL0m5uPn104EzM6w1vzz1zwKz +5pTpPI0OjgWN13Tq8+PKvm/4Ga2MjgOgPWQkslulO/oMcXbPwWC3hcRdr9tcQtn9 +Imf9n2spL/6EDFId+Hp/7QKBgAqlWdiXsWckdE1Fn91/NGHsc8syKvjjk1onDcw0 +NvVi5vcba9oGdElJX3e9mxqUKMrw7msJJv1MX8LWyMQC5L6YNYHDfbPF1q5L4i8j +8mRex97UVokJQRRA452V2vCO6S5ETgpnad36de3MUxHgCOX3qL382Qx9/THVmbma +3YfRAoGAUxL/Eu5yvMK8SAt/dJK6FedngcM3JEFNplmtLYVLWhkIlNRGDwkg3I5K +y18Ae9n7dHVueyslrb6weq7dTkYDi3iOYRW8HRkIQh06wEdbxt0shTzAJvvCQfrB +jg/3747WSsf/zBTcHihTRBdAv6OmdhV4/dD5YBfLAkLrd+mX7iE= +-----END RSA PRIVATE KEY----- diff --git a/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/files/jwt_public.pem b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/files/jwt_public.pem new file mode 100644 index 00000000..12301e01 --- /dev/null +++ b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/files/jwt_public.pem @@ -0,0 +1,9 @@ +-----BEGIN PUBLIC KEY----- +MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnzyis1ZjfNB0bBgKFMSv +vkTtwlvBsaJq7S5wA+kzeVOVpVWwkWdVha4s38XM/pa/yr47av7+z3VTmvDRyAHc +aT92whREFpLv9cj5lTeJSibyr/Mrm/YtjCZVWgaOYIhwrXwKLqPr/11inWsAkfIy +tvHWTxZYEcXLgAXFuUuaS3uF9gEiNQwzGTU1v0FqkqTBr4B8nW3HCN47XUu0t8Y0 +e+lf4s4OxQawWD79J9/5d3Ry0vbV3Am1FtGJiJvOwRsIfVChDpYStTcHTCMqtvWb +V6L11BWkpzGXSW4Hv43qa+GSYOD2QU68Mb59oSk2OB+BtOLpJofmbGEGgvmwyCI9 +MwIDAQAB +-----END PUBLIC KEY----- diff --git a/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/files/token.jwt b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/files/token.jwt new file mode 100644 index 00000000..e38d1040 --- /dev/null +++ b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/files/token.jwt @@ -0,0 +1 @@ +eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJ0ZXN0Iiwic3ViIjoiaGFzaGlfdmF1bHRAdGVzdC5hbnNpYmxlLmNvbSIsIm5iZiI6MTYwNDgzNTEwMCwiZXhwIjozMjQ5OTA1MTM1OX0.NEWQR_Eicw8Fa9gU9HPY2M9Rp1czNTUKrICwKe7l1edaZNtgxhMGdyqnBsPrHL_dw1ZIwdvwVAioi8bEyIDEWICls0lzHwM169rrea3WEFrB5CP17A6DkvYL0cnOnGutbwUrXInPCRUfvRogIKEI-w8X-ris9LX2FBPKhXX1K3U0D8uYi5_9t8YWywTe0NkYvY-nTzMugK1MXMoBJ3fCksweJiDp6BOo3v9OU03MLgwgri2UdsqVb7WSk4XvWG-lmbiiSAWVf9BI3mecVDUHpYxbEqjv1HDG_wdX8zy1ZlAFbjp3kIpMlDVK1Q5nu_VPDzQrEvPdTnOzU36LE4UF-w diff --git a/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/files/token_invalid.jwt b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/files/token_invalid.jwt new file mode 100644 index 00000000..aa608e6c --- /dev/null +++ b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/files/token_invalid.jwt @@ -0,0 +1 @@ +eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiIxMjM0IiwidXNlcl9jbGFpbSI6InVzZXJfY2xhaW0iLCJuYmYiOjE2MDQ4MzUxMDAsImV4cCI6MzI0OTkwNTEzNTl9.etc2WSH7kR3fHFlVt4wlBYFKNn7Z4DQcRVXUK4gGF-Q diff --git a/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/handlers/main.yml b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/handlers/main.yml new file mode 100644 index 00000000..19e556d3 --- /dev/null +++ b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/handlers/main.yml @@ -0,0 +1,32 @@ +--- +# notify 'test_managed_vault_cleanup' for tasks related to the +# vault server that is started by these tests +# (those tasks should skip if the vault server is external to the test run) +- name: 'Kill vault process' + shell: "kill $(cat {{ local_temp_dir }}/vault.pid)" + ignore_errors: true + listen: test_managed_vault_cleanup + +- name: Stop tinyproxy + shell: + cmd: | + kill $(cat "{{ local_temp_dir }}/tinyproxy.pid") + rm -f "{{ local_temp_dir }}/tinyproxy.pid" + removes: "{{ local_temp_dir }}/tinyproxy.pid" + +- name: Uninstall tinyproxy + vars: + # check 'Install unzip' task to know why we set ansible_python_interpreter + ansible_python_interpreter: "{{ + '/usr/bin/python3' if ansible_distribution in ['Ubuntu', 'Debian'] else ansible_python.executable + }}" + package: + name: tinyproxy + state: absent + +# notify 'cleanup' for any handlers that should always run at the end of tests +- name: 'Delete temp dir' + file: + path: '{{ local_temp_dir }}' + state: absent + listen: cleanup diff --git a/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/tasks/approle_secret_id_less_setup.yml b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/tasks/approle_secret_id_less_setup.yml new file mode 100644 index 00000000..34758813 --- /dev/null +++ b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/tasks/approle_secret_id_less_setup.yml @@ -0,0 +1,19 @@ +- name: 'Create an approle policy' + shell: "echo '{{ policy }}' | {{ vault_cmd }} policy write approle-policy-2 -" + vars: + policy: | + path "auth/approle/login" { + capabilities = [ "create", "read" ] + } + +- name: 'Enable the AppRole auth method' + command: '{{ vault_cmd }} auth enable approle' + register: enable_approle + failed_when: "enable_approle.rc!=0 and 'path is already in use' not in enable_approle.stderr" + +- name: 'Create a named role without secret id' + command: '{{ vault_cmd }} write auth/approle/role/test-role-2 policies="test-policy,approle-policy-2" bind_secret_id=false secret_id_bound_cidrs="0.0.0.0/0"' + +- name: 'Fetch the RoleID of the AppRole' + command: '{{ vault_cmd }} read -field=role_id auth/approle/role/test-role-2/role-id' + register: role_id_cmd_2 diff --git a/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/tasks/approle_secret_id_less_test.yml b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/tasks/approle_secret_id_less_test.yml new file mode 100644 index 00000000..8be45809 --- /dev/null +++ b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/tasks/approle_secret_id_less_test.yml @@ -0,0 +1,44 @@ +- vars: + role_id: '{{ role_id_cmd_2.stdout }}' + block: + - name: 'Fetch secrets using "hashi_vault" lookup' + set_fact: + secret1: "{{ lookup('community.hashi_vault.hashi_vault', conn_params ~ 'secret=' ~ vault_kv2_path ~ '/secret1 auth_method=approle role_id=' ~ role_id) }}" + secret2: "{{ lookup('community.hashi_vault.hashi_vault', conn_params ~ 'secret=' ~ vault_kv2_path ~ '/secret2 auth_method=approle role_id=' ~ role_id) }}" + + - name: 'Check secret values' + fail: + msg: 'unexpected secret values' + when: secret1['value'] != 'foo1' or secret2['value'] != 'foo2' + + - name: 'Failure expected when erroneous credentials are used' + vars: + secret_wrong_cred: "{{ lookup('community.hashi_vault.hashi_vault', conn_params ~ 'secret=' ~ vault_kv2_path ~ '/secret2 auth_method=approle role_id=foobar') }}" + debug: + msg: 'Failure is expected ({{ secret_wrong_cred }})' + register: test_wrong_cred + ignore_errors: true + + - name: 'Failure expected when unauthorized secret is read' + vars: + secret_unauthorized: "{{ lookup('community.hashi_vault.hashi_vault', conn_params ~ 'secret=' ~ vault_kv2_path ~ '/secret3 auth_method=approle role_id=' ~ role_id) }}" + debug: + msg: 'Failure is expected ({{ secret_unauthorized }})' + register: test_unauthorized + ignore_errors: true + + - name: 'Failure expected when inexistent secret is read' + vars: + secret_inexistent: "{{ lookup('community.hashi_vault.hashi_vault', conn_params ~ 'secret=' ~ vault_kv2_path ~ '/non_existent_secret4 auth_method=approle role_id=' ~ role_id) }}" + debug: + msg: 'Failure is expected ({{ secret_inexistent }})' + register: test_inexistent + ignore_errors: true + + - name: 'Check expected failures' + assert: + msg: "an expected failure didn't occur" + that: + - test_wrong_cred is failed + - test_unauthorized is failed + - test_inexistent is failed diff --git a/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/tasks/approle_setup.yml b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/tasks/approle_setup.yml new file mode 100644 index 00000000..01793052 --- /dev/null +++ b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/tasks/approle_setup.yml @@ -0,0 +1,33 @@ +- name: "Setup block" + vars: + is_default_path: "{{ this_path == default_path }}" + path_key: "{{ this_path | replace('-','_') }}" + block: + - name: 'Enable the AppRole auth method' + command: '{{ vault_cmd }} auth enable {{ "" if is_default_path else "-path " ~ this_path }} approle' + + - name: 'Create an approle policy' + command: + cmd: '{{ vault_cmd }} policy write approle-policy -' + stdin: | + path "auth/{{ this_path }}/login" { + capabilities = [ "create", "read" ] + } + + - name: 'Create a named role' + command: |- + {{ vault_cmd }} write auth/{{ this_path }}/role/test-role policies="{{ 'test-policy' if is_default_path else 'alt-policy' }},approle-policy" + + - name: 'Fetch the RoleID of the AppRole' + command: '{{ vault_cmd }} read -field=role_id auth/{{ this_path }}/role/test-role/role-id' + register: role_id_cmd + + + - name: 'Get a SecretID issued against the AppRole' + command: '{{ vault_cmd }} write -field=secret_id -f auth/{{ this_path }}/role/test-role/secret-id' + register: secret_id_cmd + + - name: register path-specific variables + set_fact: + '{{ path_key }}_role_id': "{{ role_id_cmd.stdout }}" + '{{ path_key }}_secret_id': "{{ secret_id_cmd.stdout }}" diff --git a/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/tasks/approle_test.yml b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/tasks/approle_test.yml new file mode 100644 index 00000000..951daa53 --- /dev/null +++ b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/tasks/approle_test.yml @@ -0,0 +1,68 @@ +- name: "Test block" + vars: + path_key: "{{ this_path | replace('-','_') }}" + role_id: "{{ lookup('vars', path_key ~ '_role_id') }}" + secret_id: "{{ lookup('vars', path_key ~ '_secret_id') }}" + is_default_path: "{{ this_path == default_path }}" + common: "{{ conn_params ~ ('' if is_default_path else 'mount_point=' ~ this_path ~ ' ') }}" + block: + - name: 'Fetch secrets using "hashi_vault" lookup' + set_fact: + secret1: "{{ lookup('community.hashi_vault.hashi_vault', common ~ 'secret=' ~ vault_kv2_path ~ '/secret1 auth_method=approle secret_id=' ~ secret_id ~ ' role_id=' ~ role_id) }}" + secret2: "{{ lookup('community.hashi_vault.hashi_vault', common ~ 'secret=' ~ vault_kv2_path ~ '/secret2 auth_method=approle secret_id=' ~ secret_id ~ ' role_id=' ~ role_id) }}" + + - name: 'Check secret values' + fail: + msg: 'unexpected secret values' + when: secret1['value'] != 'foo1' or secret2['value'] != 'foo2' + + # the purpose of this test is to catch when the plugin accepts mount_point but does not pass it into hvac + # we set the policy of the default mount to deny access to this secret and so we expect failure when the mount + # is default, and success when the mount is alternate + - name: 'Check auth mount differing secret value' + vars: + secret5: "{{ lookup('community.hashi_vault.hashi_vault', common ~ 'secret=' ~ vault_kv2_path ~ '/secret5', auth_method='approle', role_id=role_id, secret_id=secret_id) }}" + debug: + msg: + - "Checking secret5 with {{ auth_type }} auth via mount path '{{ this_path }}'" + - "{{ secret5 }}" + register: secret5_status + ignore_errors: true + + - assert: + fail_msg: "A token from mount path '{{ this_path}}' had incorrect access to secret5" + that: >- + (is_default_path and (secret5_status is failed)) + or (not is_default_path and (secret5_status is not failed)) + + - name: 'Failure expected when erroneous credentials are used' + vars: + secret_wrong_cred: "{{ lookup('community.hashi_vault.hashi_vault', common ~ 'secret=' ~ vault_kv2_path ~ '/secret2 auth_method=approle secret_id=toto role_id=' ~ role_id) }}" + debug: + msg: 'Failure is expected ({{ secret_wrong_cred }})' + register: test_wrong_cred + ignore_errors: true + + - name: 'Failure expected when unauthorized secret is read' + vars: + secret_unauthorized: "{{ lookup('community.hashi_vault.hashi_vault', common ~ 'secret=' ~ vault_kv2_path ~ '/secret3 auth_method=approle secret_id=' ~ secret_id ~ ' role_id=' ~ role_id) }}" + debug: + msg: 'Failure is expected ({{ secret_unauthorized }})' + register: test_unauthorized + ignore_errors: true + + - name: 'Failure expected when inexistent secret is read' + vars: + secret_inexistent: "{{ lookup('community.hashi_vault.hashi_vault', common ~ 'secret=' ~ vault_kv2_path ~ '/non_existent_secret4 auth_method=approle secret_id=' ~ secret_id ~ ' role_id=' ~ role_id) }}" + debug: + msg: 'Failure is expected ({{ secret_inexistent }})' + register: test_inexistent + ignore_errors: true + + - name: 'Check expected failures' + assert: + msg: "an expected failure didn't occur" + that: + - test_wrong_cred is failed + - test_unauthorized is failed + - test_inexistent is failed diff --git a/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/tasks/jwt_setup.yml b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/tasks/jwt_setup.yml new file mode 100644 index 00000000..2464a47b --- /dev/null +++ b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/tasks/jwt_setup.yml @@ -0,0 +1,22 @@ +- name: "Setup block" + vars: + is_default_path: "{{ this_path == default_path }}" + block: + - name: 'Enable the JWT auth method' + command: '{{ vault_cmd }} auth enable {{ "" if is_default_path else "-path " ~ this_path }} jwt' + + - name: 'Configure the JWT auth method' + command: '{{ vault_cmd }} write auth/{{ this_path }}/config jwt_validation_pubkeys={{ jwt_public_key | quote }}' + vars: + jwt_public_key: '{{ lookup("file", "jwt_public.pem") }}' + + - name: 'Create a named role' + command: + cmd: '{{ vault_cmd }} write auth/{{ this_path }}/role/test-role -' + stdin: |- + { + "role_type": "jwt", + "policies": "{{ 'test-policy' if is_default_path else 'alt-policy' }}", + "user_claim": "sub", + "bound_audiences": "test" + } | to_json diff --git a/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/tasks/jwt_test.yml b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/tasks/jwt_test.yml new file mode 100644 index 00000000..85d6642d --- /dev/null +++ b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/tasks/jwt_test.yml @@ -0,0 +1,68 @@ +- name: "Test block" + vars: + role_id: test-role + jwt: '{{ lookup("file", "token.jwt") }}' + jwt_invalid: '{{ lookup("file", "token_invalid.jwt") }}' + is_default_path: "{{ this_path == default_path }}" + common: "{{ conn_params ~ ('' if is_default_path else 'mount_point=' ~ this_path ~ ' ') }}" + block: + - name: 'Fetch secrets using "hashi_vault" lookup' + set_fact: + secret1: "{{ lookup('community.hashi_vault.hashi_vault', common ~ 'secret=' ~ vault_kv2_path ~ '/secret1 auth_method=jwt jwt=' ~ jwt ~ ' role_id=' ~ role_id) }}" + secret2: "{{ lookup('community.hashi_vault.hashi_vault', common ~ 'secret=' ~ vault_kv2_path ~ '/secret2 auth_method=jwt jwt=' ~ jwt ~ ' role_id=' ~ role_id) }}" + + - name: 'Check secret values' + fail: + msg: 'unexpected secret values' + when: secret1['value'] != 'foo1' or secret2['value'] != 'foo2' + + # the purpose of this test is to catch when the plugin accepts mount_point but does not pass it into hvac + # we set the policy of the default mount to deny access to this secret and so we expect failure when the mount + # is default, and success when the mount is alternate + - name: 'Check auth mount differing secret value' + vars: + secret5: "{{ lookup('community.hashi_vault.hashi_vault', common ~ 'secret=' ~ vault_kv2_path ~ '/secret5', auth_method='jwt', jwt=jwt, role_id=role_id) }}" + debug: + msg: + - "Checking secret5 with {{ auth_type }} auth via mount path '{{ this_path }}'" + - "{{ secret5 }}" + register: secret5_status + ignore_errors: true + + - assert: + fail_msg: "A token from mount path '{{ this_path}}' had incorrect access to secret5" + that: >- + (is_default_path and (secret5_status is failed)) + or (not is_default_path and (secret5_status is not failed)) + + - name: 'Failure expected when erroneous credentials are used' + vars: + secret_wrong_cred: "{{ lookup('community.hashi_vault.hashi_vault', common ~ 'secret=' ~ vault_kv2_path ~ '/secret2 auth_method=jwt jwt=' ~ jwt_invalid ~ ' role_id=' ~ role_id) }}" + debug: + msg: 'Failure is expected ({{ secret_wrong_cred }})' + register: test_wrong_cred + ignore_errors: true + + - name: 'Failure expected when unauthorized secret is read' + vars: + secret_unauthorized: "{{ lookup('community.hashi_vault.hashi_vault', common ~ 'secret=' ~ vault_kv2_path ~ '/secret3 auth_method=jwt jwt=' ~ jwt ~ ' role_id=' ~ role_id) }}" + debug: + msg: 'Failure is expected ({{ secret_unauthorized }})' + register: test_unauthorized + ignore_errors: true + + - name: 'Failure expected when non-existent secret is read' + vars: + secret_inexistent: "{{ lookup('community.hashi_vault.hashi_vault', common ~ 'secret=' ~ vault_kv2_path ~ '/non_existent_secret4 auth_method=jwt jwt=' ~ jwt ~ ' role_id=' ~ role_id) }}" + debug: + msg: 'Failure is expected ({{ secret_inexistent }})' + register: test_inexistent + ignore_errors: true + + - name: 'Check expected failures' + assert: + msg: "an expected failure didn't occur" + that: + - test_wrong_cred is failed + - test_unauthorized is failed + - test_inexistent is failed diff --git a/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/tasks/main.yml b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/tasks/main.yml new file mode 100644 index 00000000..13a2e39e --- /dev/null +++ b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/tasks/main.yml @@ -0,0 +1,49 @@ +--- +#################################################################### +# WARNING: These are designed specifically for Ansible tests # +# and should not be used as examples of how to write Ansible roles # +#################################################################### + +- name: Create a local temporary directory + tempfile: + state: directory + register: tempfile_result + notify: cleanup + +- set_fact: + local_temp_dir: '{{ tempfile_result.path }}' + +- import_tasks: vault_server.yml + +- import_tasks: tinyproxy_server.yml + +- import_tasks: tests.yml + vars: + auth_type: token + +- name: approle tests + include_tasks: + file: tests.yml + apply: + vars: + auth_type: approle + default_path: "{{ auth_methods.approle.default_path }}" + this_path: "{{ item }}" + when: ansible_distribution != 'RedHat' or ansible_distribution_major_version is version('7', '>') + loop: "{{ auth_methods.approle.paths }}" + +- import_tasks: tests.yml + vars: + auth_type: approle_secret_id_less + when: ansible_distribution != 'RedHat' or ansible_distribution_major_version is version('7', '>') + +- name: jwt tests + include_tasks: + file: tests.yml + apply: + vars: + auth_type: jwt + default_path: "{{ auth_methods.jwt.default_path }}" + this_path: "{{ item }}" + when: ansible_distribution != 'RedHat' or ansible_distribution_major_version is version('7', '>') + loop: "{{ auth_methods.jwt.paths }}" diff --git a/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/tasks/tests.yml b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/tasks/tests.yml new file mode 100644 index 00000000..ad7f172b --- /dev/null +++ b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/tasks/tests.yml @@ -0,0 +1,85 @@ +- name: 'test {{ auth_type }} auth without SSL (lookup parameters)' + include_tasks: '{{ auth_type }}_test.yml' + vars: + conn_params: 'url=http://localhost:8200 ' + +- name: 'test {{ auth_type }} auth without SSL (lookup parameters, with string proxy)' + include_tasks: '{{ auth_type }}_test.yml' + vars: + conn_params: 'url=http://localhost:8200 proxies=http://127.0.0.1:8001 ' + +- name: 'test {{ auth_type }} auth without SSL (environment variable)' + include_tasks: '{{ auth_type }}_test.yml' + args: + apply: + vars: + conn_params: '' + environment: + VAULT_ADDR: 'http://localhost:8200' + +- when: cryptography_version.stdout is version('1.6', '>=') + block: + - name: 'test {{ auth_type }} auth with certs (validation enabled, lookup parameters)' + include_tasks: '{{ auth_type }}_test.yml' + vars: + conn_params: 'url=https://localhost:8201 ca_cert={{ local_temp_dir }}/cert.pem validate_certs=True ' + + - name: 'test {{ auth_type }} auth with certs (validation enabled, lookup parameters, with dict proxy)' + include_tasks: '{{ auth_type }}_test.yml' + vars: + conn_params: 'url=https://localhost:8201 ca_cert={{ local_temp_dir }}/cert.pem validate_certs=True proxies=https=http://127.0.0.1:8001 ' + + - name: 'test {{ auth_type }} auth with certs (validation enabled, environment variables)' + include_tasks: '{{ auth_type }}_test.yml' + args: + apply: + vars: + conn_params: '' + environment: + VAULT_ADDR: 'https://localhost:8201' + VAULT_CACERT: '{{ local_temp_dir }}/cert.pem' + + - name: 'test {{ auth_type }} auth with certs (validation disabled, lookup parameters)' + include_tasks: '{{ auth_type }}_test.yml' + vars: + conn_params: 'url=https://localhost:8201 validate_certs=False ' + + - name: 'test {{ auth_type }} auth with certs (validation using env VAR, lookup parameters)' + include_tasks: '{{ auth_type }}_test.yml' + args: + apply: + vars: + conn_params: '' + environment: + VAULT_ADDR: 'https://localhost:8201' + VAULT_SKIP_VERIFY: 1 + + - name: 'test {{ auth_type }} auth with certs (validation using env VAR (True), lookup parameters)' + include_tasks: '{{ auth_type }}_test.yml' + args: + apply: + vars: + conn_params: '' + environment: + VAULT_ADDR: 'https://localhost:8201' + VAULT_SKIP_VERIFY: True + + - name: 'test {{ auth_type }} auth with certs (validation using env VAR (y), lookup parameters)' + include_tasks: '{{ auth_type }}_test.yml' + args: + apply: + vars: + conn_params: '' + environment: + VAULT_ADDR: 'https://localhost:8201' + VAULT_SKIP_VERIFY: y + + - name: 'test {{ auth_type }} auth with certs (precedence of validate_certs over env VAR, lookup parameters)' + include_tasks: '{{ auth_type }}_test.yml' + args: + apply: + vars: + conn_params: 'validate_certs=False ' + environment: + VAULT_ADDR: 'https://localhost:8201' + VAULT_SKIP_VERIFY: False diff --git a/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/tasks/tinyproxy_server.yml b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/tasks/tinyproxy_server.yml new file mode 100644 index 00000000..7b7091f1 --- /dev/null +++ b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/tasks/tinyproxy_server.yml @@ -0,0 +1,25 @@ +--- +- name: Install tinyproxy + vars: + # check 'Install unzip' task to know why we set ansible_python_interpreter + ansible_python_interpreter: "{{ + '/usr/bin/python3' if ansible_distribution in ['Ubuntu', 'Debian'] else ansible_python.executable + }}" + package: + name: tinyproxy + notify: Uninstall tinyproxy + +- name: Configure tinyproxy + copy: + content: | + Port 8001 + MaxClients 100 + StartServers 10 + PidFile "{{ local_temp_dir }}/tinyproxy.pid" + dest: "{{ local_temp_dir }}/tinyproxy.conf" + +- name: Start tinyproxy + shell: + cmd: tinyproxy -c "{{ local_temp_dir }}/tinyproxy.conf" + creates: "{{ local_temp_dir }}/tinyproxy.pid" + notify: Stop tinyproxy diff --git a/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/tasks/token_setup.yml b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/tasks/token_setup.yml new file mode 100644 index 00000000..006657db --- /dev/null +++ b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/tasks/token_setup.yml @@ -0,0 +1,7 @@ +- name: 'Create a test credentials (token)' + command: '{{ vault_cmd }} token create -policy test-policy -field token' + register: user_token_cmd + +- name: 'Create a test credentials (token)' + command: '{{ vault_cmd }} token create -policy test-policy -field token -no-default-policy' + register: user_token_no_default_policy_cmd diff --git a/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/tasks/token_test.yml b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/tasks/token_test.yml new file mode 100644 index 00000000..7d7742b7 --- /dev/null +++ b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/tasks/token_test.yml @@ -0,0 +1,112 @@ +- name: "Test token with no default policy (missing lookup-self)" + vars: + user_token: '{{ user_token_no_default_policy_cmd.stdout }}' + lookup_terms: "{{ conn_params ~ 'secret=' ~ vault_kv2_path ~ '/secret1 auth_method=token token=' ~ user_token }}" + block: + - name: "Fetch a secret with no default policy token (failure expected)" + debug: + msg: "{{ lookup('community.hashi_vault.hashi_vault', lookup_terms) }}" + ignore_errors: yes + + - name: "Fetch a secret with no default policy token - with no validation" + debug: + msg: "{{ lookup('community.hashi_vault.hashi_vault', lookup_terms ~ ' token_validate=false') }}" + +- name: "Normal token tests" + vars: + user_token: '{{ user_token_cmd.stdout }}' + block: + - name: 'Fetch secrets using "hashi_vault" lookup' + set_fact: + gen_secret1: "{{ lookup('community.hashi_vault.hashi_vault', conn_params ~ 'secret=' ~ vault_gen_path ~ '/secret1 auth_method=token token=' ~ user_token) }}" + gen_secret2: "{{ lookup('community.hashi_vault.hashi_vault', conn_params ~ 'secret=' ~ vault_gen_path ~ '/secret2 token=' ~ user_token) }}" + kv1_secret1: "{{ lookup('community.hashi_vault.hashi_vault', conn_params ~ 'secret=' ~ vault_kv1_path ~ '/secret1 auth_method=token token=' ~ user_token) }}" + kv1_secret2: "{{ lookup('community.hashi_vault.hashi_vault', conn_params ~ 'secret=' ~ vault_kv1_path ~ '/secret2 token=' ~ user_token) }}" + kv2_secret1: "{{ lookup('community.hashi_vault.hashi_vault', conn_params ~ 'secret=' ~ vault_kv2_path ~ '/secret1 auth_method=token token=' ~ user_token) }}" + kv2_secret2: "{{ lookup('community.hashi_vault.hashi_vault', conn_params ~ 'secret=' ~ vault_kv2_path ~ '/secret2 token=' ~ user_token) }}" + kv2_secret4: "{{ lookup('community.hashi_vault.hashi_vault', conn_params ~ 'secret=' ~ vault_kv2_path ~ '/secret4?version=2 token=' ~ user_token) }}" + kv2_secret2_as_raw: "{{ lookup('community.hashi_vault.hashi_vault', vault_kv2_path ~ '/secret2 ' ~ conn_params, auth_method='token', token=user_token, return_format='raw') }}" + kv2_secrets_as_dict: "{{ lookup('community.hashi_vault.hashi_vault', vault_kv2_multi_path ~ '/secrets ' ~ conn_params, auth_method='token', token=user_token) }}" + kv2_secrets_as_values: "{{ query('community.hashi_vault.hashi_vault', vault_kv2_multi_path ~ '/secrets ' ~ conn_params, auth_method='token', token=user_token, return_format='values') }}" + + - name: 'Check secret generic values' + fail: + msg: 'unexpected secret values' + when: gen_secret1['value'] != 'foo1' or gen_secret2['value'] != 'foo2' + + - name: 'Check secret kv1 values' + fail: + msg: 'unexpected secret values' + when: kv1_secret1['value'] != 'foo1' or kv1_secret2['value'] != 'foo2' + + - name: 'Check secret kv2 values' + fail: + msg: 'unexpected secret values' + when: kv2_secret1['value'] != 'foo1' or kv2_secret2['value'] != 'foo2' or kv2_secret4['value'] != 'foo5' + + - name: 'Check kv2 secret raw return value' + fail: + msg: + when: >- + 'data' not in kv2_secret2_as_raw + or 'data' not in kv2_secret2_as_raw['data'] + or 'metadata' not in kv2_secret2_as_raw['data'] + + - name: "Check multiple secrets as dict" + fail: + msg: 'Return value was not dict or items do not match.' + when: (kv2_secrets_as_dict | type_debug != 'dict') or (kv2_secrets_as_dict['value{{ item }}'] != 'foo{{ item }}') + loop: [1, 2, 3] + + - name: "Check multiple secrets as values" + fail: + msg: 'Return value was not list or items do not match.' + when: (kv2_secrets_as_values | type_debug != 'list') or ('foo{{ item }}' not in kv2_secrets_as_values) + loop: [1, 2, 3] + + - name: "Check multiple secrets as dict" + fail: + msg: 'Return value was not dict or items do not match.' + when: (kv2_secrets_as_dict | type_debug != 'dict') or (kv2_secrets_as_dict['value{{ item }}'] != 'foo{{ item }}') + loop: [1, 2, 3] + + - name: 'Failure expected when erroneous credentials are used' + vars: + secret_wrong_cred: "{{ lookup('community.hashi_vault.hashi_vault', conn_params ~ 'secret=' ~ vault_kv2_path ~ '/secret2 auth_method=token token=wrong_token') }}" + debug: + msg: 'Failure is expected ({{ secret_wrong_cred }})' + register: test_wrong_cred + ignore_errors: true + + - name: 'Failure expected when unauthorized secret is read' + vars: + secret_unauthorized: "{{ lookup('community.hashi_vault.hashi_vault', conn_params ~ 'secret=' ~ vault_kv2_path ~ '/secret3 token=' ~ user_token) }}" + debug: + msg: 'Failure is expected ({{ secret_unauthorized }})' + register: test_unauthorized + ignore_errors: true + + - name: 'Failure expected when inexistent secret is read' + vars: + secret_inexistent: "{{ lookup('community.hashi_vault.hashi_vault', conn_params ~ 'secret=' ~ vault_kv2_path ~ '/non_existent_secret4 token=' ~ user_token) }}" + debug: + msg: 'Failure is expected ({{ secret_inexistent }})' + register: test_inexistent + ignore_errors: true + + - name: 'Failure expected when wrong proxy is used' + vars: + secret_wrong_proxy: "{{ lookup('community.hashi_vault.hashi_vault', (conn_params|regex_replace('proxies=\\S*')) ~ 'proxies=' ~ (conn_params is search('url=https://') | ternary('https', 'http')) ~ '=http://127.0.0.1:4567 secret=' ~ vault_kv2_path ~ '/secret1 auth_method=token token=' ~ user_token) }}" + debug: + msg: 'Failure is expected ({{secret_wrong_proxy}})' + register: test_wrong_proxy + ignore_errors: true + + - name: 'Check expected failures' + assert: + msg: "an expected failure didn't occur" + that: + - test_wrong_cred is failed + - test_unauthorized is failed + - test_inexistent is failed + - test_wrong_proxy is failed and test_wrong_proxy.msg is search('Cannot connect to proxy') diff --git a/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/tasks/vault_download.yml b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/tasks/vault_download.yml new file mode 100644 index 00000000..09209890 --- /dev/null +++ b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/tasks/vault_download.yml @@ -0,0 +1,36 @@ +--- +# NOTE: 'package' does not work properly with Ubuntu/Debian (like the 'default' docker image), +# if you're running in a version of Python other than the "system" Python, due to system libraries +# needed for the python 'apt' package. See https://stackoverflow.com/q/13708180/3905079 +# So for those OSes, we'll set the Python interpreter to the symlink in /usr/bin which should +# always be the correct one that corresponds to the system libraries. +# +# All this just for unzip, which is only needed to unzip the vault binary to set up for testing. +# TODO: revisit how we set up vault in the first place or how we host the binary (.gz?) +- name: 'Install unzip' + vars: + # by assuming python3 here we're probably condeming this to not work on older Ubuntu/Debian (from like 2014?) + # but the alternative is probably reimplementing parts of interpreter_discovery.py + ansible_python_interpreter: "{{ + '/usr/bin/python3' if ansible_distribution in ['Ubuntu', 'Debian'] else ansible_python.executable + }}" + package: + name: unzip + when: ansible_distribution != "MacOSX" # unzip already installed (#TODO: get MacOSX tests working again) + +- name: "Create bin directory" + file: + path: '{{ vault_bin }}' + state: directory + +- name: 'Download vault binary' + get_url: + url: '{{ vault_uri }}' + dest: '{{ vault_zip }}' + +- name: 'Extract vault binary' + unarchive: + src: '{{ vault_zip }}' + dest: '{{ vault_bin }}' + remote_src: yes + creates: '{{ vault_cmd }}' diff --git a/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/tasks/vault_server.yml b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/tasks/vault_server.yml new file mode 100644 index 00000000..bd7ab571 --- /dev/null +++ b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/tasks/vault_server.yml @@ -0,0 +1,96 @@ +--- +- name: Install Hashi Vault on controlled node and test + block: + + - when: cryptography_version.stdout is version('1.6', '>=') + block: + - name: Generate privatekey + community.crypto.openssl_privatekey: + path: '{{ local_temp_dir }}/privatekey.pem' + + - name: Generate CSR + community.crypto.openssl_csr: + path: '{{ local_temp_dir }}/csr.csr' + privatekey_path: '{{ local_temp_dir }}/privatekey.pem' + subject: + commonName: localhost + + - name: Generate selfsigned certificate + community.crypto.openssl_certificate: + path: '{{ local_temp_dir }}/cert.pem' + csr_path: '{{ local_temp_dir }}/csr.csr' + privatekey_path: '{{ local_temp_dir }}/privatekey.pem' + provider: selfsigned + selfsigned_digest: sha256 + register: selfsigned_certificate + + - name: "Check if vault binary exists" + stat: + path: '{{ vault_cmd }}' + follow: yes + get_attributes: no + get_checksum: no + get_mime: no + register: bin_status + + - name: "Download vault if not local" + when: not bin_status.stat.exists + import_tasks: vault_download.yml + + - environment: + # used by vault command + VAULT_DEV_ROOT_TOKEN_ID: '47542cbc-6bf8-4fba-8eda-02e0a0d29a0a' + block: + - name: 'Create configuration file' + template: + src: vault_config.hcl.j2 + dest: '{{ local_temp_dir }}/vault_config.hcl' + + - name: 'Start vault service' + environment: + VAULT_ADDR: 'http://localhost:8200' + block: + - name: 'Start vault server (dev mode enabled)' + shell: 'nohup {{ vault_cmd }} server -dev -config {{ local_temp_dir }}/vault_config.hcl </dev/null >/dev/null 2>&1 &' + notify: test_managed_vault_cleanup + + - name: 'Create generic secrets engine' + command: '{{ vault_cmd }} secrets enable -path=gen generic' + + - name: 'Create KV v1 secrets engine' + command: '{{ vault_cmd }} secrets enable -path=kv1 -version=1 kv' + + - name: 'Create KV v2 secrets engine' + command: '{{ vault_cmd }} secrets enable -path=kv2 -version=2 kv' + + - name: 'Create a test policy' + command: + cmd: '{{ vault_cmd }} policy write test-policy -' + stdin: '{{ vault_test_policy }}' + + - name: 'Create an alternate policy' + command: + cmd: '{{ vault_cmd }} policy write alt-policy -' + stdin: '{{ vault_alt_policy }}' + + - name: 'Create generic secrets' + command: '{{ vault_cmd }} write {{ vault_gen_path }}/secret{{ item }} value=foo{{ item }}' + loop: [1, 2, 3] + + - name: 'Create KV v1 secrets' + command: '{{ vault_cmd }} kv put {{ vault_kv1_path }}/secret{{ item }} value=foo{{ item }}' + loop: [1, 2, 3] + + - name: 'Create KV v2 secrets' + command: '{{ vault_cmd }} kv put {{ vault_kv2_path | regex_replace("/data") }}/secret{{ item }} value=foo{{ item }}' + loop: [1, 2, 3, 4, 5] + + - name: 'Update KV v2 secret4 with new value to create version' + command: '{{ vault_cmd }} kv put {{ vault_kv2_path | regex_replace("/data") }}/secret4 value=foo5' + + - name: 'Create multiple KV v2 secrets under one path' + command: '{{ vault_cmd }} kv put {{ vault_kv2_multi_path | regex_replace("/data") }}/secrets value1=foo1 value2=foo2 value3=foo3' + + #### auth method setup + - name: setup auth methods + import_tasks: vault_server_auth_setup.yml diff --git a/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/tasks/vault_server_auth_setup.yml b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/tasks/vault_server_auth_setup.yml new file mode 100644 index 00000000..207bfd09 --- /dev/null +++ b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/tasks/vault_server_auth_setup.yml @@ -0,0 +1,27 @@ +--- +- name: setup token auth + import_tasks: token_setup.yml + +- name: setup approle auth + include_tasks: + file: approle_setup.yml + apply: + vars: + default_path: "{{ auth_methods.approle.default_path }}" + this_path: "{{ item }}" + when: ansible_distribution != 'RedHat' or ansible_distribution_major_version is version('7', '>') + loop: "{{ auth_methods.approle.paths }}" + +- name: setup approle secret_id_less auth + import_tasks: approle_secret_id_less_setup.yml + when: ansible_distribution != 'RedHat' or ansible_distribution_major_version is version('7', '>') + +- name: setup jwt auth + include_tasks: + file: jwt_setup.yml + apply: + vars: + default_path: "{{ auth_methods.jwt.default_path }}" + this_path: "{{ item }}" + when: ansible_distribution != 'RedHat' or ansible_distribution_major_version is version('7', '>') + loop: "{{ auth_methods.jwt.paths }}" diff --git a/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/templates/vault_config.hcl.j2 b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/templates/vault_config.hcl.j2 new file mode 100644 index 00000000..37a3cd7f --- /dev/null +++ b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/templates/vault_config.hcl.j2 @@ -0,0 +1,10 @@ +# {{ ansible_managed }} +pid_file = "{{ local_temp_dir }}/vault.pid" +{% if cryptography_version.stdout is version('1.6', '>=') %} +listener "tcp" { + tls_key_file = "{{ local_temp_dir }}/privatekey.pem" + tls_cert_file = "{{ local_temp_dir }}/cert.pem" + tls_disable = false + address = "localhost:8201" +} +{% endif %} diff --git a/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/vars/.gitignore b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/vars/.gitignore new file mode 100644 index 00000000..7c9d611b --- /dev/null +++ b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/lookup_hashi_vault/vars/.gitignore @@ -0,0 +1,3 @@ +* +!.gitignore +!README.md diff --git a/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/playbooks/download_vault.yml b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/playbooks/download_vault.yml new file mode 100644 index 00000000..d5664c77 --- /dev/null +++ b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/playbooks/download_vault.yml @@ -0,0 +1,9 @@ +--- +- hosts: localhost + force_handlers: yes + gather_facts: yes + gather_subset: '!min,!all,distribution' + tasks: + - import_role: + name: lookup_hashi_vault + tasks_from: vault_download diff --git a/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/playbooks/install_dependencies.yml b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/playbooks/install_dependencies.yml new file mode 100644 index 00000000..26aa7c36 --- /dev/null +++ b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/playbooks/install_dependencies.yml @@ -0,0 +1,19 @@ +- hosts: localhost + tasks: + - name: Install cryptography + pip: + name: cryptography + + - name: "RedHat <= 7, select last version compatible with request 2.6.0 (this version doesn't support approle or jwt auth)" + set_fact: + hvac_package: 'hvac==0.2.5' + when: ansible_distribution == 'RedHat' and ansible_distribution_major_version is version('7', '<=') + + - name: 'CentOS < 7, select last version compatible with Python 2.6' + set_fact: + hvac_package: 'hvac==0.5.0' + when: ansible_distribution == 'CentOS' and ansible_distribution_major_version is version('7', '<') + + - name: 'Install hvac Python package' + pip: + name: "{{ hvac_package|default('hvac') }}" diff --git a/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/playbooks/test_lookup_hashi_vault.yml b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/playbooks/test_lookup_hashi_vault.yml new file mode 100644 index 00000000..090c19df --- /dev/null +++ b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/playbooks/test_lookup_hashi_vault.yml @@ -0,0 +1,10 @@ +- hosts: localhost + force_handlers: yes + tasks: + - name: register cryptography version + command: "{{ ansible_python.executable }} -c 'import cryptography; print(cryptography.__version__)'" + register: cryptography_version + + - name: Test lookup hashi_vault + import_role: + name: lookup_hashi_vault/lookup_hashi_vault diff --git a/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/runme.sh b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/runme.sh new file mode 100755 index 00000000..4aec084e --- /dev/null +++ b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/lookup_hashi_vault/runme.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +set -eux + +export ANSIBLE_TEST_PREFER_VENV=1 # see https://github.com/ansible/ansible/pull/73000#issuecomment-757012395; can be removed once Ansible 2.9 and ansible-base 2.10 support has been dropped +source virtualenv.sh + +# First install pyOpenSSL, then test lookup in a second playbook in order to +# workaround this error which occurs on OS X 10.11 only: +# +# TASK [lookup_hashi_vault : test token auth with certs (validation enabled, lookup parameters)] *** +# included: lookup_hashi_vault/tasks/token_test.yml for testhost +# +# TASK [lookup_hashi_vault : Fetch secrets using "hashi_vault" lookup] *** +# From cffi callback <function _verify_callback at 0x106f995f0>: +# Traceback (most recent call last): +# File "/usr/local/lib/python2.7/site-packages/OpenSSL/SSL.py", line 309, in wrapper +# _lib.X509_up_ref(x509) +# AttributeError: 'module' object has no attribute 'X509_up_ref' +# fatal: [testhost]: FAILED! => { "msg": "An unhandled exception occurred while running the lookup plugin 'hashi_vault'. Error was a <class 'requests.exceptions.SSLError'>, original message: HTTPSConnectionPool(host='localhost', port=8201): Max retries exceeded with url: /v1/auth/token/lookup-self (Caused by SSLError(SSLError(\"bad handshake: Error([('SSL routines', 'ssl3_get_server_certificate', 'certificate verify failed')],)\",),))"} + +ANSIBLE_ROLES_PATH=../ \ + ansible-playbook playbooks/install_dependencies.yml -v "$@" + +ANSIBLE_ROLES_PATH=../ \ + ansible-playbook playbooks/test_lookup_hashi_vault.yml -v "$@" diff --git a/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/setup_pkg_mgr/tasks/main.yml b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/setup_pkg_mgr/tasks/main.yml new file mode 100644 index 00000000..24d02228 --- /dev/null +++ b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/setup_pkg_mgr/tasks/main.yml @@ -0,0 +1,17 @@ +--- +#################################################################### +# WARNING: These are designed specifically for Ansible tests # +# and should not be used as examples of how to write Ansible roles # +#################################################################### + +- set_fact: + pkg_mgr: community.general.pkgng + ansible_pkg_mgr: community.general.pkgng + cacheable: yes + when: ansible_os_family == "FreeBSD" + +- set_fact: + pkg_mgr: community.general.zypper + ansible_pkg_mgr: community.general.zypper + cacheable: yes + when: ansible_os_family == "Suse" diff --git a/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/setup_remote_constraints/aliases b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/setup_remote_constraints/aliases new file mode 100644 index 00000000..1ad133ba --- /dev/null +++ b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/setup_remote_constraints/aliases @@ -0,0 +1 @@ +needs/file/tests/utils/constraints.txt diff --git a/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/setup_remote_constraints/meta/main.yml b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/setup_remote_constraints/meta/main.yml new file mode 100644 index 00000000..1810d4be --- /dev/null +++ b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/setup_remote_constraints/meta/main.yml @@ -0,0 +1,2 @@ +dependencies: + - setup_remote_tmp_dir diff --git a/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/setup_remote_constraints/tasks/main.yml b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/setup_remote_constraints/tasks/main.yml new file mode 100644 index 00000000..d4f8148c --- /dev/null +++ b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/setup_remote_constraints/tasks/main.yml @@ -0,0 +1,13 @@ +#################################################################### +# WARNING: These are designed specifically for Ansible tests # +# and should not be used as examples of how to write Ansible roles # +#################################################################### + +- name: record constraints.txt path on remote host + set_fact: + remote_constraints: "{{ remote_tmp_dir }}/constraints.txt" + +- name: copy constraints.txt to remote host + copy: + src: "{{ role_path }}/../../../utils/constraints.txt" + dest: "{{ remote_constraints }}" diff --git a/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/setup_remote_tmp_dir/handlers/main.yml b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/setup_remote_tmp_dir/handlers/main.yml new file mode 100644 index 00000000..229037c8 --- /dev/null +++ b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/setup_remote_tmp_dir/handlers/main.yml @@ -0,0 +1,5 @@ +- name: delete temporary directory + include_tasks: default-cleanup.yml + +- name: delete temporary directory (windows) + include_tasks: windows-cleanup.yml diff --git a/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/setup_remote_tmp_dir/tasks/default-cleanup.yml b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/setup_remote_tmp_dir/tasks/default-cleanup.yml new file mode 100644 index 00000000..39872d74 --- /dev/null +++ b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/setup_remote_tmp_dir/tasks/default-cleanup.yml @@ -0,0 +1,5 @@ +- name: delete temporary directory + file: + path: "{{ remote_tmp_dir }}" + state: absent + no_log: yes diff --git a/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/setup_remote_tmp_dir/tasks/default.yml b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/setup_remote_tmp_dir/tasks/default.yml new file mode 100644 index 00000000..1e0f51b8 --- /dev/null +++ b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/setup_remote_tmp_dir/tasks/default.yml @@ -0,0 +1,11 @@ +- name: create temporary directory + tempfile: + state: directory + suffix: .test + register: remote_tmp_dir + notify: + - delete temporary directory + +- name: record temporary directory + set_fact: + remote_tmp_dir: "{{ remote_tmp_dir.path }}" diff --git a/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/setup_remote_tmp_dir/tasks/main.yml b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/setup_remote_tmp_dir/tasks/main.yml new file mode 100644 index 00000000..93d786f0 --- /dev/null +++ b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/integration/targets/setup_remote_tmp_dir/tasks/main.yml @@ -0,0 +1,15 @@ +#################################################################### +# WARNING: These are designed specifically for Ansible tests # +# and should not be used as examples of how to write Ansible roles # +#################################################################### + +- name: make sure we have the ansible_os_family and ansible_distribution_version facts + setup: + gather_subset: distribution + when: ansible_facts == {} + +- include_tasks: "{{ lookup('first_found', files)}}" + vars: + files: + - "{{ ansible_os_family | lower }}.yml" + - "default.yml" diff --git a/collections-debian-merged/ansible_collections/community/hashi_vault/tests/requirements.yml b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/requirements.yml new file mode 100644 index 00000000..d34da086 --- /dev/null +++ b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/requirements.yml @@ -0,0 +1,4 @@ +--- +integration_tests_dependencies: + - community.crypto +unit_tests_dependencies: [] diff --git a/collections-debian-merged/ansible_collections/community/hashi_vault/tests/utils/constraints.txt b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/utils/constraints.txt new file mode 100644 index 00000000..ae6000ae --- /dev/null +++ b/collections-debian-merged/ansible_collections/community/hashi_vault/tests/utils/constraints.txt @@ -0,0 +1,52 @@ +coverage >= 4.2, < 5.0.0, != 4.3.2 ; python_version <= '3.7' # features in 4.2+ required, avoid known bug in 4.3.2 on python 2.6, coverage 5.0+ incompatible +coverage >= 4.5.4, < 5.0.0 ; python_version > '3.7' # coverage had a bug in < 4.5.4 that would cause unit tests to hang in Python 3.8, coverage 5.0+ incompatible +cryptography < 2.2 ; python_version < '2.7' # cryptography 2.2 drops support for python 2.6 +deepdiff < 4.0.0 ; python_version < '3' # deepdiff 4.0.0 and later require python 3 +jinja2 < 2.11 ; python_version < '2.7' # jinja2 2.11 and later require python 2.7 or later +urllib3 < 1.24 ; python_version < '2.7' # urllib3 1.24 and later require python 2.7 or later +pywinrm >= 0.3.0 # message encryption support +sphinx < 1.6 ; python_version < '2.7' # sphinx 1.6 and later require python 2.7 or later +sphinx < 1.8 ; python_version >= '2.7' # sphinx 1.8 and later are currently incompatible with rstcheck 3.3 +pygments >= 2.4.0 # Pygments 2.4.0 includes bugfixes for YAML and YAML+Jinja lexers +wheel < 0.30.0 ; python_version < '2.7' # wheel 0.30.0 and later require python 2.7 or later +yamllint != 1.8.0, < 1.14.0 ; python_version < '2.7' # yamllint 1.8.0 and 1.14.0+ require python 2.7+ +pycrypto >= 2.6 # Need features found in 2.6 and greater +ncclient >= 0.5.2 # Need features added in 0.5.2 and greater +idna < 2.6, >= 2.5 # linode requires idna < 2.9, >= 2.5, requests requires idna < 2.6, but cryptography will cause the latest version to be installed instead +paramiko < 2.4.0 ; python_version < '2.7' # paramiko 2.4.0 drops support for python 2.6 +pytest < 3.3.0 ; python_version < '2.7' # pytest 3.3.0 drops support for python 2.6 +pytest < 5.0.0 ; python_version == '2.7' # pytest 5.0.0 and later will no longer support python 2.7 +pytest-forked < 1.0.2 ; python_version < '2.7' # pytest-forked 1.0.2 and later require python 2.7 or later +pytest-forked >= 1.0.2 ; python_version >= '2.7' # pytest-forked before 1.0.2 does not work with pytest 4.2.0+ (which requires python 2.7+) +ntlm-auth >= 1.3.0 # message encryption support using cryptography +requests < 2.20.0 ; python_version < '2.7' # requests 2.20.0 drops support for python 2.6 +requests-ntlm >= 1.1.0 # message encryption support +requests-credssp >= 0.1.0 # message encryption support +voluptuous >= 0.11.0 # Schema recursion via Self +openshift >= 0.6.2, < 0.9.0 # merge_type support +virtualenv < 16.0.0 ; python_version < '2.7' # virtualenv 16.0.0 and later require python 2.7 or later +pathspec < 0.6.0 ; python_version < '2.7' # pathspec 0.6.0 and later require python 2.7 or later +pyopenssl < 18.0.0 ; python_version < '2.7' # pyOpenSSL 18.0.0 and later require python 2.7 or later +pyfmg == 0.6.1 # newer versions do not pass current unit tests +pyyaml < 5.1 ; python_version < '2.7' # pyyaml 5.1 and later require python 2.7 or later +pycparser < 2.19 ; python_version < '2.7' # pycparser 2.19 and later require python 2.7 or later +mock >= 2.0.0 # needed for features backported from Python 3.6 unittest.mock (assert_called, assert_called_once...) +pytest-mock >= 1.4.0 # needed for mock_use_standalone_module pytest option +xmltodict < 0.12.0 ; python_version < '2.7' # xmltodict 0.12.0 and later require python 2.7 or later +lxml < 4.3.0 ; python_version < '2.7' # lxml 4.3.0 and later require python 2.7 or later +pyvmomi < 6.0.0 ; python_version < '2.7' # pyvmomi 6.0.0 and later require python 2.7 or later +pyone == 1.1.9 # newer versions do not pass current integration tests +boto3 < 1.11 ; python_version < '2.7' # boto3 1.11 drops Python 2.6 support +botocore >= 1.10.0, < 1.14 ; python_version < '2.7' # adds support for the following AWS services: secretsmanager, fms, and acm-pca; botocore 1.14 drops Python 2.6 support +botocore >= 1.10.0 ; python_version >= '2.7' # adds support for the following AWS services: secretsmanager, fms, and acm-pca +setuptools < 45 ; python_version <= '2.7' # setuptools 45 and later require python 3.5 or later +cffi >= 1.14.2, != 1.14.3 # Yanked version which older versions of pip will still install: + +# freeze pylint and its requirements for consistent test results +astroid == 2.2.5 +isort == 4.3.15 +lazy-object-proxy == 1.3.1 +mccabe == 0.6.1 +pylint == 2.3.1 +typed-ast == 1.4.0 # 1.4.0 is required to compile on Python 3.8 +wrapt == 1.11.1 |