Module within role (library) not found/executed

31 views
Skip to first unread message

Sirk Johannsen

unread,
Jul 13, 2016, 8:43:43 AM7/13/16
to Ansible Project
Hi all,

Ansible Version 2.1.0 installed via pip 

I have a strange problem with a module in a roles library path. 
This is the structure:
roles/elasticsearch/
roles
/elasticsearch/library/
roles
/elasticsearch/library/elasticsearch_plugin.py

If I execute 
ansible-playbook playbooks/elasticsearch/cluster.yml
which basically just sets some variables and includes the above role. 

I get 
failed: [elasticsearch-node] (item={u'version': u'master', u'name': u'kopf', u'plugin': u'lmenezes/elasticsearch-kopf'}) => {"failed": true, "invocation": {"module_args": {"conf_dir": "/etc/elasticsearch/node1", "es_home": "/usr/share/elasticsearch", "instance_default_file": "/etc/default/node1_elasticsearch", "name": "kopf", "plugin": "lmenezes/elasticsearch-kopf", "state": "present", "version": "master"}, "module_name": "elasticsearch_plugin"}, "item": {"name": "kopf", "plugin": "lmenezes/elasticsearch-kopf", "version": "master"}, "msg": "unsupported parameter for module: instance_default_file"}


So 
"msg": "unsupported parameter for module: instance_default_file"
is the error here. Which is very misleading. Cause in reality it does not find the module. 

Now, If I specify a module path OR put the module in the "library" directory of the playbook it works !!! 
ansible-playbook playbooks/elasticsearch/cluster.yml -M roles/elasticsearch/library/
Output:
ok: [elasticsearch-node] => (item={u'version': u'master', u'name': u'kopf', u'plugin': u'lmenezes/elasticsearch-kopf'}) => {"changed": false, "command": "/usr/share/elasticsearch/bin/plugin list | grep -- '- kopf$'", "invocation": {"module_args": {"conf_dir": "/etc/elasticsearch/node1", "es_home": "/usr/share/elasticsearch", "instance_default_file": "/etc/default/node1_elasticsearch", "name": "kopf", "plugin": "lmenezes/elasticsearch-kopf", "state": "present", "version": "master"}, "module_name": "elasticsearch_plugin"}, "item": {"name": "kopf", "plugin": "lmenezes/elasticsearch-kopf", "version": "master"}, "output": "    - kopf\n : ", "returncode": 0, "success": true}


Help would be very appreciated ! 

Sirk

sirk.jo...@simplesurance.de

unread,
Jul 14, 2016, 12:50:56 PM7/14/16
to Ansible Project
The problem was that in ansible-extra-modules a module called "elasticsearch_plugin" already exists ! 
So renaming my module to "es_plugin" solved the problem.
Reply all
Reply to author
Forward
0 new messages