I'm having issues with the hashi_vault lookup plugin 
<https://github.com/ansible/ansible/blob/d64e2912745d44536e4a52c55e7c5248972b8a87/lib/ansible/plugins/lookup/hashi_vault.py>
.

I've verified that Python, pip, and hvac are all installed on both the 
remote host and the local host. However, whenever I try to run my 
app_server.yml playbook, I receive a fatal error.
fatal: [app_server01]: FAILED! => {"failed": true, "msg": "An unhandled 
exception occurred while running the lookup plugin 'hashi_vault'. Error was 
a <class 'ansible.errors.AnsibleError'>, original message: Please pip 
install hvac to use this module"}

I've verified the installation by running python interactive cli and 
reading information from the vault server both locally and from the remote 
host.
python
>>> import os
>>> import hvac
>>> client = hvac.Client(url=os.environ['VAULT_ADDR'], token=os.environ[
'VAULT_TOKEN'])
>>> print(client.read('aws/creds/common_get_s3_build'))


Running these commands result in expected JSON output.

app_server.yml:
---
- name: Configure production App server
  hosts: "{{ target_hosts| default('app-servers') }}"


  environment:
    AWS_ACCESS_KEY: "{{ 
lookup('hashi_vault','secret=aws/creds/common_get_s3_build:access_key') }}"
    AWS_SECRET_KEY: "{{ 
lookup('hashi_vault','secret=aws/creds/common_get_s3_build:secret_key') }}"


-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to