Closed innofocus closed 2 years ago
@innofocus what Ansible version are you running and how are you including the mikrotik modules in your environment?
Hello We generally manage to use the latest version of ansible. This time is on 2.4.2.0. I've cloned the repo in a local one and use it in a roles/role name folder imported via git submodule. The module_utils is set to absolute path of roles/rolename/pythonlibs
Le 29 janv. 2018 18:37, "Valentin" notifications@github.com a écrit :
@innofocus https://github.com/innofocus what Ansible version are you running and how are you including the mikrotik modules in your environment?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/zahodi/ansible-mikrotik/issues/26#issuecomment-361323856, or mute the thread https://github.com/notifications/unsubscribe-auth/AVzXY6du_6xftRt0vNCVT_vkz8zg578vks5tPgHBgaJpZM4RwuF4 .
@innofocus. I just tested in my environment on 2.3.3.0, 2.4.0.0, and 2.4.2.0 with no issues.
We are setting up our ANSIBLE_MODULE_UTILS in our environment:
export ANSIBLE_MODULE_UTILS='./ansible-mikrotik/pythonlibs/'
See if that works for you.
I'm also struggling to get this module working and any assistance would be appreciated. I'm fairly new to ansible (only been looking at it for a couple of days now) so am probably missing something incredibly obvious to a more seasoned user.
Running ansible 2.4.2 on centos 7.4 with python 2.7.5 python and ansible installed from yum
this module cloned into /usr/share/my_modules/ansible-mikrotik
PYTHONPATH previously unset. Now set to /usr/share/my_modules/ansible-mikrotik/pythonlibs
echo $PYTHONPATH
/usr/share/my_modules/ansible-mikrotik/pythonlibs
creating a separate role that currently only has one task that i basically copied from the tests
---
- name: set interface comment
mt_interfaces:
hostname: "{{ inventory_hostname }}"
username: "{{ mt_user }}"
password: "{{ mt_pass }}"
settings: "{{ item.settings }}"
parameter: "ethernet"
with_items:
- settings:
name: ether1
comment: "Ansible controlled ether1"
running ansible-playback gives 'could not find imported module support code' error:
ansible-playbook routers.yml -vvvv
ansible-playbook 2.4.2.0
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/usr/share/my_modules']
ansible python module location = /usr/lib/python2.7/site-packages/ansible
executable location = /usr/bin/ansible-playbook
python version = 2.7.5 (default, Aug 4 2017, 00:39:18) [GCC 4.8.5 20150623 (Red Hat 4.8.5-16)]
Using /etc/ansible/ansible.cfg as config file
setting up inventory plugins
Parsed /etc/ansible/hosts inventory source with ini plugin
Loading callback plugin default of type stdout, v2.0 from /usr/lib/python2.7/site-packages/ansible/plugins/callback/__init__.pyc
PLAYBOOK: routers.yml ***************************************************************************************************************************************************************
1 plays in routers.yml
PLAY [192.168.88.1] *****************************************************************************************************************************************************************
META: ran handlers
TASK [mikrotik : set ip address] ****************************************************************************************************************************************************
task path: /etc/ansible/roles/mikrotik/tasks/main.yml:2
fatal: [192.168.88.1]: FAILED! => {
"msg": "Could not find imported module support code for mt_interfaces. Looked for either MikrotikIdempotent.py or mt_common.py"
}
to retry, use: --limit @/etc/ansible/routers.retry
PLAY RECAP **************************************************************************************************************************************************************************
192.168.88.1 : ok=0 changed=0 unreachable=0 failed=1
I'm targeting an actual mikrotik device, not the vagrant simulation. Using a mAP 2nD (https://mikrotik.com/product/RBmAP2nD)
Hi @fairytaletrash, it looks like you are not actually import the mikrotik module libraries properly. They should be in
While embedded Tests were working well, once trying to use the module in a real env, ansible isn't able to find the module, even with module _utils settled: Exception type: class ansible.errors.AnsibleParserError
Hint : the module_utils setting is a bad idea since it may break other modules environment.