Vyos BGP configuration using Ansible

I have this BGP configuration setup on Vyos 1.3

vyos@vyos# show protocols bgp
bgp 65535 {
address-family {
ipv4-unicast {
network {
ipv6-unicast {
network 2001:db8:1::/48 {
neighbor {
address-family {
ipv4-unicast {
remote-as 65535

I want to implement this same configuration using ansible module.

I have checked BGP module.

There are parameters for setting up ‘network’, ‘remote-as’, ‘route-reflector’ etc but
I did not see any parameters for ‘address-family’, ‘ipv4-unicast’ and setting up network inside it.
Also I did not see any parameter to setup as-path-list specifying regex.

How should I proceed further? I know I can use jinja file but is there any way I can use BGP modules to setup above BGP configuration?

Hi @qwerty ,

Try using this ansible module to handle ‘address-family’:

And you can configure any commands with this module:

Hi @Nikolay ,

I am getting this error.

ERROR! couldn’t resolve module/action ‘vyos.vyos.vyos_bgp_global’. This often indicates a misspelling, missing collection, or incorrect module path.

I am using Ansible 2.9 version. Do I need to use ansible 4.0 version to work with BGP modules?

Don’t worry I figured it out.
I installed the required modules using ansible-galaxy and it worked.

Hi @qwerty,

Yes, these modules are part of ansible-galaxy.
The good news is that they work :grinning: