ansible-collections / community.general

Ansible Community General Collection
https://galaxy.ansible.com/ui/repo/published/community/general/
GNU General Public License v3.0
825 stars 1.53k forks source link

tss lookup plugin: Add ability to provide additional query parameters when requesting a secret #9033

Open hendricksonet629 opened 2 weeks ago

hendricksonet629 commented 2 weeks ago

Summary

Add ability to provide additional query parameters when requesting a secret as detailed in the API. https://updates.thycotic.net/secretserver/restapiguide/11.6.3/WinAuth/#tag/Secrets/operation/SecretsService_GetSecretV2

SUMMARY Add the ability to include additional query parameters as outlined in the Secret Server API. Over time, the query parameters have changed, so it might be prudent to allow an array of free-text query parameters be added. This will allow the engineer to easily control when field name changes or is added rather than hard coding the query parameter names into the module. That is more of a suggestion based on my experiences with the Secret Server API, not a requirement.

As noted in the previous thread, some of the fields such as "autoComment" are required for some types of secrets and the current implementation does not allow for this to work.

ISSUE TYPE Feature Pull Request

COMPONENT NAME community.general/plugins/lookup/tss.py

ADDITIONAL INFORMATION

Previously requested on 2/23/2022, but PR was not finalized. https://github.com/ansible-collections/community.general/pull/4280

Issue Type

Feature Idea

Component Name

plugins/lookup/tss.py

Additional Information

- name: Create an array of query params
  hosts: localhost
  vars:
    query_params:
      - name: autoComment
        value: "Adding required comment"
      - name: includeInactive
        value: true
      - name: forceCheckIn
        value: true
  tasks:
  - name: Get the thycotic secret
    set_fact:
      secret: >-
        {{
            lookup(
                'community.general.tss',
                secret_id,
                base_url=thycotic_api_address,
                username=thycotic_username,
                password=thycotic_password
                query_param=query_params
            )
        }}

Code of Conduct

ansibullbot commented 2 weeks ago

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

ansibullbot commented 2 weeks ago

cc @delineaKrehl @russoz @tylerezimmerman click here for bot help