aos_login change default port and add version check (#24752)

* Change default port for aos_login and force type to Integer

* Add check to make sure aos-pyez is present and has the right version

* Update min version requirement in doc

* Change default port in documentation as well
This commit is contained in:
Damien 2017-05-26 03:59:51 -07:00 committed by John R Barker
parent 8c50105a6c
commit 6dd1fc6f34

View file

@ -37,7 +37,7 @@ description:
ansible facts with the variable I(aos_session)
This module is not idempotent and do not support check mode.
requirements:
- "aos-pyez >= 0.6.0"
- "aos-pyez >= 0.6.1"
options:
server:
description:
@ -46,7 +46,7 @@ options:
port:
description:
- Port number to use when connecting to the AOS server.
default: 8888
default: 443
user:
description:
- Login username to use when connecting to the AOS server.
@ -81,6 +81,7 @@ aos_session:
'''
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.aos import check_aos_version
try:
from apstra.aosom.session import Session
@ -114,7 +115,7 @@ def main():
module = AnsibleModule(
argument_spec=dict(
server=dict(required=True),
port=dict(default='8888'),
port=dict(default='443', type="int"),
user=dict(default='admin'),
passwd=dict(default='admin', no_log=True)))
@ -122,6 +123,9 @@ def main():
module.fail_json(msg='aos-pyez is not installed. Please see details '
'here: https://github.com/Apstra/aos-pyez')
# Check if aos-pyez is present and match the minimum version
check_aos_version(module, '0.6.1')
aos_login(module)
if __name__ == '__main__':