Skip to content

Commit

Permalink
fixes import and requirements for 2.10
Browse files Browse the repository at this point in the history
- modifies module plugin import to work with Ansible 2.10
- includes Ansible and Python requirements files
- updates README with requirements
  • Loading branch information
tchiapuziowong committed Oct 23, 2020
1 parent e7eecac commit c1d7843
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 3 deletions.
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,21 @@ Requirements

* Python 2.7 or 3.5+
* Ansible 2.8.1 or later
* Ansible 2.10+ requires `ansible.netcommon` collection to be installed
* Minimum supported AOS-CX firmware version 10.03.
* Enable REST on your AOS-CX device with the following commands:
```
switch(config)# https-server rest access-mode read-write
switch(config)# https-server vrf mgmt
```
* Install all Ansible requirements, with the following command:
```
ansible-galaxy install -r requirements.yml
```
* Install all Python requirements with the following command:
```
pip install -r requirements.txt
```

SSH/CLI Modules
---------------
Expand Down Expand Up @@ -219,7 +228,6 @@ issues at all please open an issue on our [Github](https://github.com/aruba/aosc

For more contribution opportunities follow our guidelines outlined in our [CONTRIBUTING.md](https://github.com/aruba/aoscx-ansible-role/blob/master/CONTRIBUTING.md)


License
-------

Expand All @@ -231,4 +239,5 @@ Author Information
- Yang Liu (@yliu-aruba)
- Tiffany Chiapuzio-Wong (@tchiapuziowong)
- Derek Wang (@derekwangHPEAruba)
- Daniel Alvarado Bonilla (@daniel-alvarado)

5 changes: 4 additions & 1 deletion cliconf_plugins/aoscx.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
from ansible.errors import AnsibleConnectionFailure
from ansible.module_utils._text import to_text
from ansible.module_utils.common._collections_compat import Mapping
from ansible.module_utils.network.common.utils import to_list
try:
from ansible.module_utils.network.common.utils import to_list, ComplexList
except ImportError:
from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import to_list, ComplexList
from ansible.plugins.cliconf import CliconfBase, enable_mode


Expand Down
5 changes: 4 additions & 1 deletion module_utils/aoscx.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@
from ansible.module_utils.basic import env_fallback
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.basic import missing_required_lib
from ansible.module_utils.network.common.utils import to_list, ComplexList
try:
from ansible.module_utils.network.common.utils import to_list, ComplexList
except ImportError:
from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import to_list, ComplexList
from ansible.module_utils.connection import exec_command, Connection, ConnectionError
from ansible.module_utils.aoscx_ztp import connect_ztp_device

Expand Down
3 changes: 3 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
paramiko>=2.7.1
requests>=2.23.0

4 changes: 4 additions & 0 deletions requirements.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
collections:
# Install ansible.netcommon from Ansible Galaxy.
- ansible.netcommon

0 comments on commit c1d7843

Please sign in to comment.