diff --git a/library/mt_command.py b/library/mt_command.py index 6dc4d7f..8dc0491 100644 --- a/library/mt_command.py +++ b/library/mt_command.py @@ -43,8 +43,8 @@ password: 123 ''' -import mt_api -from mt_common import clean_params +from ansible.module_utils import mt_api +from ansible.module_utils.mt_common import clean_params from ansible.module_utils.basic import AnsibleModule diff --git a/library/mt_dhcp_server.py b/library/mt_dhcp_server.py index 688650f..3f6abd3 100644 --- a/library/mt_dhcp_server.py +++ b/library/mt_dhcp_server.py @@ -49,7 +49,7 @@ dns: 192.168.1.20 ''' -from mt_common import clean_params, MikrotikIdempotent +from ansible.module_utils.mt_common import clean_params, MikrotikIdempotent from ansible.module_utils.basic import AnsibleModule diff --git a/library/mt_hotspot.py b/library/mt_hotspot.py index da1a65b..3c350e6 100644 --- a/library/mt_hotspot.py +++ b/library/mt_hotspot.py @@ -50,7 +50,7 @@ use-radius: yes ''' -from mt_common import clean_params, MikrotikIdempotent +from ansible.module_utils.mt_common import clean_params, MikrotikIdempotent from ansible.module_utils.basic import AnsibleModule diff --git a/library/mt_interface_bridge.py b/library/mt_interface_bridge.py index 75929a2..db18989 100644 --- a/library/mt_interface_bridge.py +++ b/library/mt_interface_bridge.py @@ -101,8 +101,8 @@ comment: ansible_test ''' -import mt_api -from mt_common import clean_params +from ansible.module_utils import mt_api +from ansible.module_utils.mt_common import clean_params from ansible.module_utils.basic import AnsibleModule diff --git a/library/mt_interface_bridge_port.py b/library/mt_interface_bridge_port.py index 1d7e18c..aed5d85 100644 --- a/library/mt_interface_bridge_port.py +++ b/library/mt_interface_bridge_port.py @@ -90,8 +90,8 @@ comment: ansible_test ''' -import mt_api -from mt_common import clean_params +from ansible.module_utils import mt_api +from ansible.module_utils.mt_common import clean_params from ansible.module_utils.basic import AnsibleModule diff --git a/library/mt_interface_wireless.py b/library/mt_interface_wireless.py index a062cdb..d09a3d8 100644 --- a/library/mt_interface_wireless.py +++ b/library/mt_interface_wireless.py @@ -51,7 +51,7 @@ ''' from ansible.module_utils.basic import AnsibleModule -from mt_common import clean_params, MikrotikIdempotent +from ansible.module_utils.mt_common import clean_params, MikrotikIdempotent def main(): diff --git a/library/mt_interfaces.py b/library/mt_interfaces.py index eac851b..0abe9d7 100644 --- a/library/mt_interfaces.py +++ b/library/mt_interfaces.py @@ -53,7 +53,7 @@ mtu: 1501 ''' -from mt_common import clean_params, MikrotikIdempotent +from ansible.module_utils.mt_common import clean_params, MikrotikIdempotent from ansible.module_utils.basic import AnsibleModule diff --git a/library/mt_ip.py b/library/mt_ip.py index a13b3cb..8cc1ff4 100644 --- a/library/mt_ip.py +++ b/library/mt_ip.py @@ -50,7 +50,7 @@ ''' from ansible.module_utils.basic import AnsibleModule -from mt_common import clean_params, MikrotikIdempotent +from ansible.module_utils.mt_common import clean_params, MikrotikIdempotent def main(): diff --git a/library/mt_ip_address.py b/library/mt_ip_address.py index 750dab9..17fd421 100644 --- a/library/mt_ip_address.py +++ b/library/mt_ip_address.py @@ -49,7 +49,7 @@ comment: "link 3" ''' -import mt_api +from ansible.module_utils import mt_api import socket #import mt_action #TODO: get this working diff --git a/library/mt_ip_firewall.py b/library/mt_ip_firewall.py index 84f8a8d..34ba021 100644 --- a/library/mt_ip_firewall.py +++ b/library/mt_ip_firewall.py @@ -55,7 +55,7 @@ password: "{{ mt_pass }}" state: present parameter: filter - settings: + rule: action: accept chain: forward comment: controlled by ansible @@ -63,7 +63,7 @@ ''' from ansible.module_utils.basic import AnsibleModule -import mt_api +from ansible.module_utils import mt_api import re from copy import copy diff --git a/library/mt_ip_firewall_addresslist.py b/library/mt_ip_firewall_addresslist.py index 2a16302..ff7c4b1 100644 --- a/library/mt_ip_firewall_addresslist.py +++ b/library/mt_ip_firewall_addresslist.py @@ -47,7 +47,7 @@ - 19.134.52.23/23 ''' -import mt_api +from ansible.module_utils import mt_api from ansible.module_utils.basic import AnsibleModule diff --git a/library/mt_login_test.py b/library/mt_login_test.py index 75ea270..7778016 100644 --- a/library/mt_login_test.py +++ b/library/mt_login_test.py @@ -1,7 +1,7 @@ #! /usr/bin/python import json -import mt_api +from ansible.module_utils import mt_api from ansible.module_utils.basic import AnsibleModule diff --git a/library/mt_neighbor.py b/library/mt_neighbor.py index 229b2bd..993765e 100644 --- a/library/mt_neighbor.py +++ b/library/mt_neighbor.py @@ -49,7 +49,7 @@ discover: "yes" ''' -from mt_common import clean_params, MikrotikIdempotent +from ansible.module_utils.mt_common import clean_params, MikrotikIdempotent from ansible.module_utils.basic import AnsibleModule diff --git a/library/mt_radius.py b/library/mt_radius.py index 6141a9c..cf8590b 100644 --- a/library/mt_radius.py +++ b/library/mt_radius.py @@ -49,7 +49,7 @@ ''' from ansible.module_utils.basic import AnsibleModule -from mt_common import MikrotikIdempotent +from ansible.module_utils.mt_common import MikrotikIdempotent def main(): diff --git a/library/mt_radius_backup.py b/library/mt_radius_backup.py index ee7e276..5c99578 100644 --- a/library/mt_radius_backup.py +++ b/library/mt_radius_backup.py @@ -89,7 +89,7 @@ timeout: '2s500ms' ''' -import mt_api +from ansible.module_utils import mt_api from ansible.module_utils.basic import AnsibleModule diff --git a/library/mt_snmp.py b/library/mt_snmp.py index 43a10d3..2159073 100644 --- a/library/mt_snmp.py +++ b/library/mt_snmp.py @@ -49,7 +49,7 @@ name: ansible_managed ''' -from mt_common import clean_params, MikrotikIdempotent +from ansible.module_utils.mt_common import clean_params, MikrotikIdempotent from ansible.module_utils.basic import AnsibleModule diff --git a/library/mt_system.py b/library/mt_system.py index 9216f19..fc4afe1 100644 --- a/library/mt_system.py +++ b/library/mt_system.py @@ -51,7 +51,7 @@ name: test_ansible ''' -from mt_common import clean_params, MikrotikIdempotent +from ansible.module_utils.mt_common import clean_params, MikrotikIdempotent from ansible.module_utils.basic import AnsibleModule diff --git a/library/mt_system_scheduler.py b/library/mt_system_scheduler.py index c633800..22e3583 100644 --- a/library/mt_system_scheduler.py +++ b/library/mt_system_scheduler.py @@ -64,8 +64,8 @@ on_event: put "hello" ''' -import mt_api -from mt_common import clean_params +from ansible.module_utils import mt_api +from ansible.module_utils.mt_common import clean_params from ansible.module_utils.basic import AnsibleModule diff --git a/library/mt_tool.py b/library/mt_tool.py index c81508a..f898600 100644 --- a/library/mt_tool.py +++ b/library/mt_tool.py @@ -49,7 +49,7 @@ from: foo@bar.com ''' -from mt_common import clean_params, MikrotikIdempotent +from ansible.module_utils.mt_common import clean_params, MikrotikIdempotent from ansible.module_utils.basic import AnsibleModule diff --git a/library/mt_user.py b/library/mt_user.py index cf4a5b8..74680ad 100644 --- a/library/mt_user.py +++ b/library/mt_user.py @@ -50,7 +50,7 @@ group: read ''' -from mt_common import clean_params, MikrotikIdempotent +from ansible.module_utils.mt_common import clean_params, MikrotikIdempotent from ansible.module_utils.basic import AnsibleModule diff --git a/pythonlibs/mt_api/__init__.py b/pythonlibs/mt_api/__init__.py index 877e416..9040374 100644 --- a/pythonlibs/mt_api/__init__.py +++ b/pythonlibs/mt_api/__init__.py @@ -7,9 +7,9 @@ import ssl import sys -from .retryloop import RetryError -from .retryloop import retryloop -from .socket_utils import set_keepalive +from ansible.module_utils.mt_api.retryloop import RetryError +from ansible.module_utils.mt_api.retryloop import retryloop +from ansible.module_utils.mt_api.socket_utils import set_keepalive PY2 = sys.version_info[0] < 3 logger = logging.getLogger(__name__) diff --git a/pythonlibs/mt_common.py b/pythonlibs/mt_common.py index 8cab34c..bebd704 100644 --- a/pythonlibs/mt_common.py +++ b/pythonlibs/mt_common.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -import mt_api +from ansible.module_utils import mt_api import re import sys diff --git a/tests/integration/ansible.cfg b/tests/integration/ansible.cfg new file mode 100644 index 0000000..11d15df --- /dev/null +++ b/tests/integration/ansible.cfg @@ -0,0 +1,2 @@ +[defaults] +module_utils = ./pythonlibs/ diff --git a/tests/integration/run_tests.sh b/tests/integration/run_tests.sh index 7eb7b8c..d0db9e5 100755 --- a/tests/integration/run_tests.sh +++ b/tests/integration/run_tests.sh @@ -4,7 +4,6 @@ ABSOLUTE_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" pushd . cd "$ABSOLUTE_PATH" -export PYTHONPATH=./pythonlibs/ ansible-playbook tests.yml --diff -i 127.0.0.1, $@ popd >/dev/null