| 1 |
# Ansible Cisco Small Bussiness Switches (SMB) module |
| 2 |
|
| 3 |
Thorough project check - |
| 4 |
[](https://github.com/ansible-collections/community.ciscosmb/actions/workflows/CI.yml) |
| 5 |
|
| 6 |
Ansible Galaxy module for Cisco SMB switches - SG250, SG300, SG500, SG350, SG550, CBS350, C1300 |
| 7 |
|
| 8 |
## Communication |
| 9 |
|
| 10 |
- Join the Ansible forum: |
| 11 |
|
| 12 |
- [Get Help](https://forum.ansible.com/c/help/6): get help or help others. |
| 13 |
- [Social Spaces](https://forum.ansible.com/c/chat/4): gather and interact with fellow enthusiasts. |
| 14 |
- [News & Announcements](https://forum.ansible.com/c/news/5): track project-wide announcements including social |
| 15 |
events. |
| 16 |
|
| 17 |
- The Ansible [Bullhorn newsletter](https://docs.ansible.com/ansible/devel/community/communication.html#the-bullhorn): |
| 18 |
used to announce releases and important changes. |
| 19 |
|
| 20 |
For more information about communication, see the |
| 21 |
[Ansible communication guide](https://docs.ansible.com/ansible/devel/community/communication.html). |
| 22 |
|
| 23 |
## Install |
| 24 |
|
| 25 |
``` |
| 26 |
ansible-galaxy collection install community.ciscosmb |
| 27 |
``` |
| 28 |
|
| 29 |
## Usage examples |
| 30 |
|
| 31 |
Tested on devices: |
| 32 |
|
| 33 |
- SG250-10P |
| 34 |
- SG350-10-K9 |
| 35 |
- SG350-28-K9 |
| 36 |
- SG500-52-K9 |
| 37 |
- SG550X-24MP-K9 |
| 38 |
- CBS350-24P-4G |
| 39 |
- SG550X-48 stack |
| 40 |
- C1300 |
| 41 |
|
| 42 |
Known to be used with broad range of: |
| 43 |
|
| 44 |
- Cisco 250 Series Smart Switches |
| 45 |
- Cisco Business 350 Series Managed Switches |
| 46 |
- Cisco 350 Series Stackable Managed Switches |
| 47 |
- Cisco 350X Series Stackable Managed Switches |
| 48 |
- Cisco 500 Series Stackable Managed Switches |
| 49 |
- Cisco 550X Series Stackable Managed Switches |
| 50 |
- Cisco Catalyst 1300 Series Switches |
| 51 |
|
| 52 |
### Required device configuration |
| 53 |
|
| 54 |
Access setup |
| 55 |
|
| 56 |
``` |
| 57 |
! you should set enable password |
| 58 |
enable password level 15 |
| 59 |
|
| 60 |
! on user you have two choices |
| 61 |
! use unpriviledged user (for example priv. 7) and "become mode" |
| 62 |
username user1 privilege 7 |
| 63 |
|
| 64 |
! or user with full privileges (priv 15) |
| 65 |
username user2 privelege 15 |
| 66 |
``` |
| 67 |
|
| 68 |
Cisco's SSH server setup |
| 69 |
|
| 70 |
``` |
| 71 |
! you have to enable SSH server |
| 72 |
ip ssh server |
| 73 |
! enable password and/or key |
| 74 |
ip ssh password-auth |
| 75 |
ip ssh pubkey-auth auto-login |
| 76 |
! generate switch ssh key pair if you did not before |
| 77 |
crypto key generate rsa |
| 78 |
|
| 79 |
! if you use public keys for users login configure that keys |
| 80 |
crypto key pubkey-chain ssh |
| 81 |
user-key user2 rsa |
| 82 |
key-string AAAAB3NzaC1......XYZ== |
| 83 |
exit |
| 84 |
``` |
| 85 |
|
| 86 |
### Python versions |
| 87 |
|
| 88 |
Tested on Python versions: |
| 89 |
|
| 90 |
- 3.6 |
| 91 |
- 3.7 |
| 92 |
- 3.8 |
| 93 |
- 3.9 |
| 94 |
- 3.10 |
| 95 |
- 3.11 |
| 96 |
- 3.12 |
| 97 |
|
| 98 |
### Running examples |
| 99 |
|
| 100 |
For your tests or quick startup use files form repository: |
| 101 |
[cismosmb_inventory_template.yml](./ciscosmb_inventory_template.yml), |
| 102 |
[cismosmb_gather_facts.yml](./ciscosmb_gather_facts.yml), [cismosmb_commands.yml](./ciscosmb_commands.yml) . |
| 103 |
|
| 104 |
Prepare your inventory file - copy file [cismosmb_inventory_template.yml](./ciscosmb_inventory_template.yml) to |
| 105 |
`cismosmb_inventory.yml` and make your changes. |
| 106 |
|
| 107 |
Then you can run |
| 108 |
|
| 109 |
``` |
| 110 |
ansible-playbook -i ciscosmb_inventory.yml cismosmb_gather_facts.yml |
| 111 |
``` |
| 112 |
|
| 113 |
or |
| 114 |
|
| 115 |
``` |
| 116 |
ansible-playbook -i ciscosmb_inventory.yml cismosmb_commands.yml |
| 117 |
``` |
| 118 |
|
| 119 |
## Developement |
| 120 |
|
| 121 |
### Setup environment |
| 122 |
|
| 123 |
``` |
| 124 |
git clone https://github.com/ansible-collections/community.ciscosmb ansible_collections/community/ciscosmb |
| 125 |
git clone --depth=1 --single-branch https://github.com/ansible-collections/ansible.netcommon.git ansible_collections/ansible/netcommon |
| 126 |
|
| 127 |
cd ansible_collections/community/ciscosmb |
| 128 |
|
| 129 |
python3 -m venv .venv |
| 130 |
. .venv/bin/activate |
| 131 |
|
| 132 |
pip install ansible |
| 133 |
pip install -r requirements-dev.txt |
| 134 |
pip install -r tests/unit/requirements.txt |
| 135 |
|
| 136 |
``` |
| 137 |
|
| 138 |
### Develop |
| 139 |
|
| 140 |
``` |
| 141 |
cd ansible_collections/community/ciscosmb |
| 142 |
git pull |
| 143 |
. .venv/bin/activate |
| 144 |
|
| 145 |
# edit files |
| 146 |
vim file |
| 147 |
cp changelogs/fragments/.keep changelogs/fragments/featureXYZ.yml |
| 148 |
vim changelogs/fragments/featureXYZ.yml |
| 149 |
|
| 150 |
# test your changes see "Testing" |
| 151 |
|
| 152 |
git commit -m "xxx" file |
| 153 |
``` |
| 154 |
|
| 155 |
### Testing |
| 156 |
|
| 157 |
``` |
| 158 |
cd ansible_collections/community/ciscosmb |
| 159 |
. .venv/bin/activate |
| 160 |
|
| 161 |
# PY="--python 3.8" # set your version or unset |
| 162 |
METHOD="--docker" # or --local if you have no Docker installed |
| 163 |
ansible-test sanity ${METHOD} ${PY} \ |
| 164 |
&& ansible-test units ${METHOD} ${PY} \ |
| 165 |
&& rm -f ./community-ciscosmb-*.tar.gz \ |
| 166 |
&& ansible-galaxy collection build -v --force \ |
| 167 |
&& export GALAXY_IMPORTER_CONFIG=./galaxy-importer.cfg \ |
| 168 |
&& python3 -m galaxy_importer.main ./community-ciscosmb-*.tar.gz \ |
| 169 |
&& rm -f ./community-ciscosmb-*.tar.gz |
| 170 |
``` |
| 171 |
|
| 172 |
### Release |
| 173 |
|
| 174 |
``` |
| 175 |
cd ansible_collections/community/ciscosmb |
| 176 |
git pull |
| 177 |
. .venv/bin/activate |
| 178 |
|
| 179 |
# edit version x.y.z. in galaxy.yml |
| 180 |
vim galaxy.yml |
| 181 |
|
| 182 |
# edit changelog fragments (template in changelogs/fragments/.keep) |
| 183 |
cp changelogs/fragments/.keep changelogs/fragments/release-x.y.z.yml |
| 184 |
vim changelogs/fragments/release-x.y.z.yml |
| 185 |
|
| 186 |
# change and generate CHANGELOG.rst |
| 187 |
antsibull-changelog lint -v |
| 188 |
antsibull-changelog release -v |
| 189 |
|
| 190 |
git commit -m "version bump to x.y.z" . |
| 191 |
git tag x.y.z |
| 192 |
git push |
| 193 |
``` |
| 194 |
|
| 195 |
## Releasing, Versioning and Deprecation |
| 196 |
|
| 197 |
See [RELEASE_POLICY.md](https://github.com/ansible-collections/community.ciscosmb/blob/main/RELEASE_POLICY.md) |
| 198 |
|
| 199 |
## Code of Conduct |
| 200 |
|
| 201 |
See [CODE_OF_CONDUCT.md](https://github.com/ansible-collections/community.ciscosmb/blob/main/CODE_OF_CONDUCT.md) |
| 202 |
|
| 203 |
## Contributing |
| 204 |
|
| 205 |
See [CONTRIBUTING.md](https://github.com/ansible-collections/community.ciscosmb/blob/main/CONTRIBUTING.md) |