Comments (17)
I have also tried to make ansible.cfg file
[defaults]
inventory = inventory
library = venv/lib/python2.7/site-packages/ansible
After this my playbooks run but task fail
(venv) ➜ vault-demo git:(master) ✗ ansible-playbook playbook.yml
PLAY [localhost] ***************************************************************
TASK [setup] *******************************************************************
ok: [localhost]
TASK [hashivault_write] ********************************************************
fatal: [localhost]: FAILED! => {"failed": true, "msg": "Could not find imported module support code for hashivault_write. Looked for either * or hashivault"}
NO MORE HOSTS LEFT *************************************************************
[WARNING]: Could not create retry file 'playbook.retry'. [Errno 2] No such file or directory: ''
PLAY RECAP *********************************************************************
localhost : ok=1 changed=0 unreachable=0 failed=1
from ansible-modules-hashivault.
It sounds like some sort of install problem, like it just can't find the module at all.
To see if I can recreate this problem, can you paste in from your venv
python --version
pip list
and let me know what OS you are using.
from ansible-modules-hashivault.
(venv) ➜ vault-demo git:(master) ✗ python --version
Python 2.7.12
(venv) ➜ vault-demo git:(master) ✗ pip list
ansible (2.1.2.0)
ansible-modules-hashivault (1.1.8)
cffi (1.8.3)
cryptography (1.5.2)
enum34 (1.1.6)
hvac (0.2.16)
idna (2.1)
ipaddress (1.0.17)
Jinja2 (2.8)
MarkupSafe (0.23)
paramiko (2.0.2)
pip (8.1.2)
pyasn1 (0.1.9)
pycparser (2.14)
pycrypto (2.6.1)
PyYAML (3.12)
requests (2.11.1)
setuptools (28.2.0)
six (1.10.0)
wheel (0.30.0a0)
OSX 10.11.6 El Capitan
from ansible-modules-hashivault.
Huh, I'm running right now on same OS, I have Python 2.7.10, but I don't see that making a difference.
(asdf) THowe-MBPro:~ THowe$ python --version
Python 2.7.10
(asdf) THowe-MBPro:~ THowe$ pip list
ansible (2.1.2.0)
ansible-modules-hashivault (1.1.8)
cffi (1.8.3)
cryptography (1.5.2)
enum34 (1.1.6)
hvac (0.2.16)
idna (2.1)
ipaddress (1.0.17)
Jinja2 (2.8)
MarkupSafe (0.23)
paramiko (2.0.2)
pip (8.1.2)
pyasn1 (0.1.9)
pycparser (2.14)
pycrypto (2.6.1)
PyYAML (3.12)
requests (2.11.1)
setuptools (28.2.0)
six (1.10.0)
wheel (0.30.0a0)
Just created a venv asdf and ran
pip install ansible ansible-modules-hashivault
I was able to write, but read failed. I have VAULT_ADDR and VAULT_TOKEN set and exported, but if you didn't have that, you'd get another error.
from ansible-modules-hashivault.
Did you make ansible.cfg or it works by default ?
from ansible-modules-hashivault.
My hosts file is empty for that test. I did add --- on my yml file:
---
- hosts: localhost
tasks:
- hashivault_write:
secret: giant
data:
foo: foe
fie: fum
- hashivault_read: secret='giant' key='fie' register='fie'
- debug: msg="Value is {{fie.value}}"
from ansible-modules-hashivault.
No ansible.cfg file
from ansible-modules-hashivault.
The register is not working for me which is odd though.
from ansible-modules-hashivault.
After remove ansible.cfg I have other error, but I suppose it's because no env vars.
TASK [hashivault_write] ********************************************************
fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "msg": "Exception: Invalid URL '/v1/secret/giant': No schema supplied. Perhaps you meant http:///v1/secret/giant?", "rc": 1, "stack_trace": "Traceback (most recent call last):\n File \"/var/folders/bp/6jc9dx8d33q94zfh8bm8x3r40000gn/T/ansible_HXt4Va/ansible_modlib.zip/ansible/module_utils/hashivault.py\", line 98, in hashivault_write\n client.write(('secret/%s' % secret), **data)\n File \"/Users/ivan.skiridomov/PycharmProjects/vault-demo/venv/lib/python2.7/site-packages/hvac/v1/__init__.py\", line 64, in write\n response = self._put('/v1/{0}'.format(path), json=kwargs)\n File \"/Users/ivan.skiridomov/PycharmProjects/vault-demo/venv/lib/python2.7/site-packages/hvac/v1/__init__.py\", line 900, in _put\n return self.__request('put', url, **kwargs)\n File \"/Users/ivan.skiridomov/PycharmProjects/vault-demo/venv/lib/python2.7/site-packages/hvac/v1/__init__.py\", line 922, in __request\n allow_redirects=False, **_kwargs)\n File \"/Users/ivan.skiridomov/PycharmProjects/vault-demo/venv/lib/python2.7/site-packages/requests/sessions.py\", line 461, in request\n prep = self.prepare_request(req)\n File \"/Users/ivan.skiridomov/PycharmProjects/vault-demo/venv/lib/python2.7/site-packages/requests/sessions.py\", line 394, in prepare_request\n hooks=merge_hooks(request.hooks, self.hooks),\n File \"/Users/ivan.skiridomov/PycharmProjects/vault-demo/venv/lib/python2.7/site-packages/requests/models.py\", line 294, in prepare\n self.prepare_url(url, params)\n File \"/Users/ivan.skiridomov/PycharmProjects/vault-demo/venv/lib/python2.7/site-packages/requests/models.py\", line 354, in prepare_url\n raise MissingSchema(error)\nMissingSchema: Invalid URL '/v1/secret/giant': No schema supplied. Perhaps you meant http:///v1/secret/giant?\n"}
from ansible-modules-hashivault.
Yeh, that looks normal. You just don't have VAULT_ADDR set and exported or you can specify in the yml for that.
from ansible-modules-hashivault.
Now it's read/write success but register no, as your write
TASK [debug] *******************************************************************
fatal: [localhost]: FAILED! => {"failed": true, "msg": "the field 'args' has an invalid value, which appears to include a variable that is undefined. The error was: 'fie' is undefined\n\nThe error appears to have been in '/Users/ivan.skiridomov/PycharmProjects/vault-demo/playbook.yml': line 10, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n - hashivault_read: secret='giant' key='fie' register='fie'\n - debug: msg=\"Value is {{fie.value}}\"\n ^ here\nWe could be wrong, but this one looks like it might be an issue with\nmissing quotes. Always quote template expression brackets when they\nstart a value. For instance:\n\n with_items:\n - {{ foo }}\n\nShould be written as:\n\n with_items:\n - \"{{ foo }}\"\n"}
from ansible-modules-hashivault.
yeh, I'm seeing that. I'm using an action plugin on top of that and I'm looking at that now to see if it does something to make the register work.
from ansible-modules-hashivault.
This works fine:
---
- hosts: localhost
tasks:
- hashivault_write:
secret: giant
data:
foo: foe
fie: fum
- hashivault_read:
secret: giant
key: fie
register: fie
- debug: msg="Value is {{fie.value}}"
TASK [debug] *******************************************************************
ok: [localhost] => {
"msg": "Value is fum"
}
from ansible-modules-hashivault.
Ah, cool, yeh, I think the register was being passed on at the wrong level and I have a hack in my action plugin to make it work (which I should get rid of).
The sample is just wrong.
from ansible-modules-hashivault.
I think I linked this in the readme, but this action plugin helps set some default values. Or use VAULT_ADDR, VAULT_TOKEN.
https://terryhowe.wordpress.com/2016/05/02/setting-ansible-module-defaults-using-action-plugins/
from ansible-modules-hashivault.
Seeing the same. Are the examples up to date? What is the solution?
from ansible-modules-hashivault.
Are you still seeing this @bearrito ? I assume you got past this. I was away all weekend.
from ansible-modules-hashivault.
Related Issues (20)
- `hashivault_pki_role` is missing a bunch of the more recent options
- hashivault_init not work with seal type transit HOT 2
- hashivault_secret_engine should support diff and check
- Possible hvac breaking change HOT 1
- whitelist_externals is deprecated in tox
- auth_method missing return value
- auth_method missing diff support HOT 1
- Policy module is missing check and diff
- oidc_auth_method_config & oidc_auth_role missing diff mode
- hashivault_db_secret_engine_config error using vault server 1.12.x and 1.13.x HOT 9
- Re-add wrap_ttl to hashivault_approle_role_secret HOT 1
- configuring allowed_other_sans parameter in hashivault_pki_role broken HOT 2
- hashivault_secret_engine doesn't support seal wrap HOT 5
- Add coverage for 'userfilter' in hashivault_auth_ldap HOT 2
- Dependency on ansible>=5.0.0 HOT 3
- TLS authentication uses removed method
- hashivault_token_renew: call to client.renew_self_token not working anymore
- https://github.com/TerryHowe/ansible-modules-hashivault/pull/467 breaks installs that use pip based hvac HOT 1
- hashivault_k8s_auth_role does not detect changes in policies
- hashivault_identity_entity_alias didn't have custom_metada parameter HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ansible-modules-hashivault.