Looking to add network CLI support for our operating system. Can any ansible expert please point us to sample code/steps/docs

Looking to add network CLI support for our operating system. Can any ansible expert please point us to sample code/steps/docs

1 Like

Welcome to the forum, @praveen.kumsagi .

That is a rather vague request.

  • What is your operating system?

  • What do you mean by “network CLI support”? That could be interpreted as installing openssh servers, or nmcli, … But what operating system doesn’t come with network CLI support out of the box?

In any case, the general answer is to figure out the steps you’d need to do manually to accomplish your goal, then use Ansible to automate those steps. It isn’t clear whether you’re asking for help automating a process vs. defining the steps of a process regardless of automation.

1 Like

I think @praveen.kumsagi means the ansible.netcommon.network_cli connection plugin, which is a way to handle network devices via SSH that do not have something close enough to regular shell access.

I’m not very familiar with it, I only know it from the community.mikrotik collection (which I help maintaining) - MikroTik devices offer an interface over SSH that’s not a shell at all, but accepts MikroTik-specific commands and outputs results as text with all kind of ANSI sequences inserted for nice TTY output. From my experience with it I would prefer any kind of API access over network_cli, since it’s generally a lot cleaner than parsing text output, but sometimes it’s hard to avoid :slight_smile:

The network-wg group (Ansible network automation working group - Ansible) links to networking-docs/network_dev_network_cli.rst at main · ansible-network/networking-docs · GitHub BTW. That document seems to be outdated though (f.ex. some links have been dead since early 2020).

2 Likes

(I moved this to the Collection Development category and added the network tag. I think both are more appropriate than Get Help and no tag, since this is clearly a development question.)

2 Likes

Hi felixfontein/Todd Lewis, Really appreciate your response, Yes FelixFontein is correct, we are looking to add ansible.netcommon.network_cli connection plugin for our Network Operating, similar to Cisco/Juniper/Arista.

I was looking for something like ios.py sample from below link but its not available, If you point me to sample file we can start working on it https://github.com/ansible/ansible/tree/devel/lib/ansible/plugins/terminal/ios.py

1 Like

If you want a random example of how using network_cli looks like:

Someone from the Network group should be able to point you to maybe better examples (this collection didn’t have involvement from the Ansible Network Team, so no idea whether it’s a good example or not).

1 Like

Thank you @felixfontein for these examples