Core network devices, such as switches, routers, and firewalls, have long had management interfaces, especially in professional environments. Command-line interfaces have always been popular on such devices as they support scripting and hence, as you have already guessed, they lend themselves extremely well to Ansible automation.
Historically, a myriad of challenges have faced teams managing these devices, including maintaining configuration, coping with the failure/loss of a device, and obtaining support in the event of an issue. Often, companies found themselves locked in to a single network vendor (or at best a small handful) to enable the use of proprietary tools to manage the network. As with any situation where you are locked into a technology, this carries both benefits and drawbacks. Add to this the complexity of software-defined networks...