Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lookup plugin (hashi_vault) not found #588

Closed
sgeraskin opened this issue Oct 6, 2021 · 7 comments
Closed

lookup plugin (hashi_vault) not found #588

sgeraskin opened this issue Oct 6, 2021 · 7 comments

Comments

@sgeraskin
Copy link

sgeraskin commented Oct 6, 2021

What needs to be done to make the function work?

test_kubeconfig: "{{ lookup('hashi_vault', 'secret=secret/data/k8s/rancher/kubeconfig/test token={{ v_token }} url={{ v_url }}') }}"

Im used 0.14.0
And I get the error

"msg": "An unhandled exception occurred while running the lookup plugin 'template'. Error was a <class 'ansible.errors.AnsibleError'>, original message: An unhandled exception occurred while templating '{{ lookup('hashi_vault', 'secret=secret/data/k8s/rancher/kubeconfig/test token={{ v_token }} url={{ v_url }}') }}'. Error was a <class 'ansible.errors.AnsibleError'>, original message: lookup plugin (hashi_vault) not found",

@kimbernator
Copy link
Contributor

At the top level of your project repository, include the following in collections/requirements.yml:

---
collections:
  - name: community.hashi_vault
    version: 1.1.3 # this is optional

You'll also want to ensure "Enable collections download" is turned on in settings -> Job settings.

Then when AWX syncs the project it will check for that requirements.yml file and install the collection you need.

@sgeraskin
Copy link
Author

Thanks!
I did as you said. But nothing has changed.
In the logs awx_task during project synchronization there are no records about the installation of the collection

@sgeraskin
Copy link
Author

TASK [fetch galaxy collections from collections/requirements.(yml/yaml)] *******11:24:59
27
[WARNING]: Unable to find
28
'/var/lib/awx/projects/_12__ansible_sgeraskin/collections' in expected paths
29
(use -vvvvv to see paths)

@sgeraskin
Copy link
Author

sgeraskin commented Oct 7, 2021

Sorry, I'm an idiot :)
Put the file in the wrong branch!
Thanks! Everything works as it should!

Please pip install hvac to use the hashi_vault lookup module.

Where do I need to install the hvac module?

@kimbernator
Copy link
Contributor

kimbernator commented Oct 7, 2021

Yep, we had the same problem. Unfortunately the only "official" way is to build your own EE image with that package installed and maintain it. You can look into Ansible-Builder if you want to get deep into the woods with customizing your EE, but the following dockerfile was a pretty easy way for me to build an image that did what I needed:

FROM <my_docker_registry>/ansible/awx-ee:0.6.0
RUN pip3 install --no-cache-dir hvac==0.10.8

Then you'll need to figure out where to store your modified image and assign it as an EE in the awx operator config:

  ee_images:
  - name: Custom AWX EE
    image: <my_docker_registry>/my-repo/my-custom-ee:0.1.0
  control_plane_ee_image: <my_docker_registry>/my-repo/my-custom-ee:0.1.0

You're also able to have multiple entries under ee_images that you can then assign job templates to individually if you find that useful.

Bit of a frustrating process for sure.

@chrismeyersfsu
Copy link
Member

chrismeyersfsu commented Oct 8, 2021

Closing. This is not a problem related to this project, awx-operator.

@yw5vruox7dr
Copy link

@kimbernator is your method still working?

Tried the same but got a permission error: ansible/awx#11854

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants