ERROR! couldn't resolve module/action 'community.hashi_vault'. #401
-
Hello everyone. I was trying to use an ansible playbook with the community.hashi_vault 5.0.0 module, but i still have : ERROR! couldn't resolve module/action ... Thanks you very much for any help/ideas edit : i also did it on another server, this time with almalinux 8.7 and it's the same error. ############################### os : almalinux 9.2
###########################################
########################################### the begining of playbook ( it's just a test vault server dont worry :D ) ---
- name: Test
hosts: localhost
tasks:
- name: test
community.hashi_vault.hashi_vault:
url: http://192.168.122.4:8200
token: hvs.CAESIGALCSn9OLtiB-6BboaickZvQFIpAeNu2vpUDywbhsKmGh4KHGh2cy5NckhBYTZ4cjNrRXFZSUNFWkhHM0VwMHI
secret: kv/foo
register: vault_data #################################################
#################################################### => full error :
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hi @Kaiser016X , welcome! The issue you have here is that Lookup plugins are used inside Jinja2 templating, like This collection contains content other than the First, I will recommend that you move away from
I also think it's a good idea to use modules instead of lookups in many cases, and there's information on that too: For your use case, I can't tell definitively from your example if you're using v1 or v2 of Vault's KV secrets engine. I will assume v2. For that, we have the So your example can be changed like so: ---
- name: Test
hosts: localhost
tasks:
- name: test
community.hashi_vault.vault_kv2_get:
url: http://192.168.122.4:8200
token: hvs.CAESIGALCSn9OLtiB-6BboaickZvQFIpAeNu2vpUDywbhsKmGh4KHGh2cy5NckhBYTZ4cjNrRXFZSUNFWkhHM0VwMHI
engine_mount_point: kv
path: foo
register: vault_data
- name: Display the secret
ansible.builtin.debug:
var: vault_data.secret If you were using KVv1 instead, the example is exactly the same, except you would use the |
Beta Was this translation helpful? Give feedback.
Hi @Kaiser016X , welcome!
The issue you have here is that
community.hashi_vault.hashi_vault
is a lookup plugin, and you are trying to use it as a module/action.Lookup plugins are used inside Jinja2 templating, like
{{ lookup('community.hashi_vault.hashi_vault', ...) }}
.This collection contains content other than the
hashi_vault
lookup, and many of those include both lookup and module forms.First, I will recommend that you move away from
community.hashi_vault.hashi_vault
toward the other content in this collection. For details on how and why, see these guides: