Ansible: Ejecutar el comando "show sysinfo" en multiples Cisco WLC (AireOS)
# Paso 1 - definir lista de IPs de los WLC donde nos conectaremos via SSH
nano /etc/ansible/hosts
[ciscoios]
WLC1 ansible_host=192.168.1.10
WLC2 ansible_host=192.168.1.11
[ciscoios:vars]
ansible_python_interpreter=/usr/bin/python3
ansible_connection=network_cli
ansible_network_os=aireos
# Paso 2 - Crear script en ansible para ejecutar el comando "show sysinfo". Tener en cuenta que tendremos que descargar el modulo community.network.aireos_config para poder gestionar Cisco WLCs en Ansible. Necesitareis descargar el módulo usando este comando:
ansible-galaxy collection install community.network
---
- name: Get SNMP info
hosts: all
gather_facts: false
tasks:
- name: Run show sysinfo on remote devices
community.network.aireos_command:
commands: show sysinfo
register: print_output
- debug: var=print_output.stdout_lines
# Paso 3 - Ejecutar script
ansible-playbook show_sysinfo_ciscowlc_ansible.yml -u <usuario_login_ssh> -k
PLAY [show WLAN summary] ******************************************************************************************************************************************************************************************
TASK [Show WLAN summary] ******************************************************************************************************************************************************************************************
ok: [WLC1]
ok: [WLC2]
TASK [debug] ******************************************************************************************************************************************************************************************************
ok: [WLC1] => {
"print_output.stdout_lines": [
[
"Number of WLANs..................................2",
"",
"WLAN ID WLAN Profile Name / SSID Status Interface Name",
"------- ------------------------------------- -------- --------------------",
"1 CorporateSSID Disabled vlan10_wlan",
"2 GuestSSID Enabled vlan20_guests",
]
]
}
ok: [WLC2] => {
"print_output.stdout_lines": [
[
"Number of WLANs..................................2",
"",
"WLAN ID WLAN Profile Name / SSID Status Interface Name PMIPv6 Mobility",
"------- ----------------------------------------------------------------------- -------- -------------------- ---------------",
"1 CorporateSSID Disabled vlan10_wlan",
"2 GuestSSIDl Disabled vlan20_guests",
]
}
PLAY RECAP ********************************************************************************************************************************************************************************************************
WLC1 : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
WLC2 : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
Comentarios
Publicar un comentario