06-28-2024 01:19 PM
I am trying to develop a role that will turn off the 2.4 and 5 ghz radios and set the desired country codes then turn them back on.
role logic:
06-29-2024 05:38 AM
When you shut down the radios, you might be taken out of the configuration context where the ap country command is valid?
06-30-2024 07:32 AM
@bigevilbeard that may be. I am not sure how I would go about determining if that is the case. Up the verbosity on the playbook would be my first inclination.
That playbook was my first attempt. I have done some further research and it appears the the ansible cisco.ios module has some limitations when it comes to operating against a 9800 controller instead of a catalyst switch.
In full disclosure I am just beginning my automation journey so take my code samples in that context. Having said that my research has lead me using the ansible.netconf module to perform the same thing. This is what was generated by an AI query so it provides just a generic conceptual playbook. I think I am on the right path, but would like to hear what others have done or offer a different approach.
06-30-2024 09:33 AM
I’m not 100% as never ran this on WLC, but thought it would like this (I’m on my phone excuse the formatting)
- name: Configure Country Code and Radio Settings
hosts: cisco_devices
connection: network_cli
gather_facts: false
tasks:
- name: Turn off 2.4 and 5 GHz radios
cisco.ios.ios_config:
lines:
- "ap dot11 24ghz shutdown"
- "ap dot11 5ghz shutdown"
- name: Set Country Codes
cisco.ios.ios_config:
lines:
- "config t" # Enter global config mode
- "ap country US,MX,CA" # Set country codes
- name: Turn on 2.4 and 5 GHz radios (Ensure correct CLI context)
cisco.ios.ios_config:
lines:
- "config t" # Enter global config mode (again, just in case)
- "no ap dot11 24ghz shutdown"
- "no ap dot11 5ghz shutdown"
I’ve not considered the netconf way, looks good tho. Great that you're exploring different options and learning through your automation journey
07-09-2024 03:52 PM - edited 07-09-2024 03:53 PM
Update. I did get the ansible.netcommon.netconf-config module to work. I never could get the cisco.ios.ios_config module to work. When it comes to configuring the 9800 wireless side it will take some creative thinking. Or at least that is the way it appears at this point in the journey. Anway for those that are interested here is the playbook/role that worked. You can use it either way with a little modification. I learned a lot. Crafting the xml from the yang model was the hardest part and took the longest. I ended up making configuration changes and inspecting the xml on an unconfigured device and then pulled the xml off an already configured 9800 WLC and used notepad++ to diff and compare. I was able to discern the changes in the two xmls and build out the changes. It was cumbersome but it worked. If anyone has any suggestions to improve the role or the xml build process, I would be grateful.
07-15-2024 10:53 PM
Hi @8uck5nort
For all devices running recent XE code (including WLC), NETCONF is my preferred API. Regarding the payload/XML build process, have a look at yangsuite; it simplifies the process tremendously.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide