Ansible network_cli becomes top level connection method for vyos



With Ansible playbooks for networking platforms, historically most of the networking modules require a provider argument per task (which supplied the connection type, username, password, etc).

With Ansible 2.5 (which you can install now, via the latest dev release) allows connection: network_cli as a top level connection which is supported by all the all the major networking vendors including vyos. The deprecation for provider won’t begin with Ansible 2.5, and will take considerable time, so there will not be any rush to update playbooks.

The network_cli connection plugins will allow playbooks to look, feel and operate just like they do on Linux hosts. Also the error reporting is significantly improved, which will help a lot of people who were frustrated with changes to Ansible in 2.3.

Here is a quick example of doing configuration backup with vyos

- hosts: network
  connection: network_cli
    - vyos_config:
        backup: yes

To run the playbook above (which I tested with vagrant), I did this->

ansible-playbook backup.yml -u vagrant -k

Here is a quick configuration example of doing fact gathering on vyos (keep in mind you can also do fact gathering on the linux OS itself with the setup module (default fact gathering for *nix hosts), since vyos is a bit different from other networking platforms as it runs on top of linux)

- hosts: network
  connection: network_cli
    - name: gather facts for vyos
        gather_subset: all
      register: vyos_debug

    - name: look at config
      debug: var=vyos_debug

To view more examples, check out my github repo here:

To read more information on Ansible 2.5 release, check out my blog post here:


Very nice! I use Ansible and I am just starting to use VyOS. What did you use to make this diagram?


I am spoiled and I sent off a diagram I made in Google slides to a graphics person who usually works in Adobe illustrator. Although I am trying to make sure all the icons are for use for everyone:


Thanks for sharing that!
Definitely good work.