Hi, I’m using Ansible CLI on an Ubuntu 22.04.
pedro@pedro:~$ ansible --version
ansible [core 2.15.6]
config file = /etc/ansible/ansible.cfg
configured module search path = ['/home/pedro/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3/dist-packages/ansible
ansible collection location = /home/pedro/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/bin/ansible
python version = 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] (/usr/bin/python3)
jinja version = 3.0.3
libyaml = True
I want to configure the Cisco Switch CBS350, it is an SMB Device, so I installed the Modul from Ciscosmb
ansible-galaxy collection install community.ciscosmb
So I tried to configure this switch with this inventory and this playbook.
inventory: (This inventory is only used for testing purposes)
[loh306]
LOH306-SWT01 ansible_host=10.20.20.23
[loh306:vars]
ansible_network_os=ios
ansible_connection=network_cli
ansible_user=user
ansible_password=password
Playbook:
---
- name: SHOW RUNNING CONFIG FROM LOH306 SWITCHES
hosts: loh306
gather_facts: no
tasks:
- name: Retrieve running configuration
community.ciscosmb.command:
commands: show running-config
register: output
- name: print output
debug:
var: output.stdout_lines
So run the Playbook, it doesn’t give any errors, but it always gives me back the same output.
Output from Playbook:
PLAY [SHOW RUNNING CONFIG FROM LOH306 SWITCHES] ****************************
TASK [Retrieve running configuration] ******************************************
ok: [LOH306-SWT01]
TASK [print output] ************************************************************
ok: [LOH306-SWT01] => {
"output.stdout_lines": [
[
"219 219 gi8 S ",
"220 220 gi8 S ",
"221 221 gi8 S ",
"222 222 gi8 S ",
"223 223 gi8 S ",
"224 224 gi8 S ",
"225 225 gi8 S ",
"226 226 gi8 S ",
"227 227 gi8 S ",
"228 228 gi8 S ",
"229 229 gi8 S ",
"230 230 gi8 S ",
"231 231 gi8 S ",
"232 232 gi8 S ",
"233 233 gi8 S ",
"234 234 gi8 S ",
"235 235 gi8 S ",
"236 236 gi8 S ",
"237 237 gi8 S ",
"238 238 gi8 S ",
"239 239 gi8 S ",
"240 240 gi8 S"
]
]
}
PLAY RECAP *********************************************************************
LOH306-SWT01 : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
I also tried to configure a Port and it didn’t work either (receveid the same output), it seems that the Switch doesn’t understand what Ansible wants to configure, does anyone have any idea where the problem might be?
Thanks!