79399884

Date: 2025-01-30 12:26:50
Score: 0.5
Natty:
Report link

It turns out that I can use the lookup() function in the inventory to perform a HC Vault lookup.

Secret data in HC vault is organized in key-value pairs. In the below example, the secret data that I was looking for was stored in the "password" key.

test:
  vars:
    ansible_connection: ansible.builtin.winrm
    ansible_winrm_server_cert_validation: "ignore"
    ansible_user: "domain\\ansibleUsr"
    ansible_winrm_transport: "kerberos"
    ansible_password: "{{ lookup('community.hashi_vault.hashi_vault', 'secret=mountPoint/data/pathToSecret token_path=/path/to/tokenDir token_file=vaultTokenFile url=https://vault.domain.com:8200 validate_certs=false').password }}"
  hosts:
    host1
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: yamh