zahodi.ansible-mikrotik/pythonlibs/mt_connection.py
2018-01-08 11:16:55 -08:00

24 lines
534 B
Python

#!/usr/bin/env python3
from ansible.module_utils import mt_api
class MikrotikConnection():
'''This will be a connection class
'''
def __init__():
self.hostname = "localhost"
self.username = "admin"
self.password = ""
def login(self):
self.mk = mt_api.Mikrotik(
self.hostname,
self.username,
self.password,
)
try:
self.mk.login()
self.login_success = True
except:
self.failed_msg = "Could not log into Mikrotik device." + " Check the username and password.",