vyos_config bug

Hi

I am trying to configure DHCP using vyos_config in VyOS 1.2.0-rc11
Following DHCP config based on vyos wiki - https://wiki.vyos.net/wiki/DHCP_server

Part of my playbook has:

  • name: Setup DNS server for eth3 - LAN with DHCP & Private IP
    vyos_config:
    lines:
    set service dhcp-server shared-network-name LAN authoritative
    set service dhcp-server shared-network-name LAN subnet 192.168.100.0/24 default-router 192.168.100.1
    set service dhcp-server shared-network-name LAN subnet 192.168.100.0/24 dns-server 192.168.100.1
    set service dhcp-server shared-network-name LAN subnet 192.168.100.0/24 lease 86400
    set service dhcp-server shared-network-name LAN subnet 192.168.100.0/24 range 0 start 192.168.100.2
    set service dhcp-server shared-network-name LAN subnet 192.168.100.0/24 range 0 stop 192.168.100.254

and this throws following error on execution:

TASK [Setup DNS server for eth3 - LAN with DHCP & Private IP] ****************************************************************************************************************************************************************************************************************
fatal: [host]: FAILED! => {“changed”: false, “msg”: "8.100.2 set service dhcp-server shared-network-name LAN sub \rnet 192.168.100.0/24 range 0 stop 192.168.100.254\r\n\r\n Configuration path: service dhcp-server shared-network-name LAN authoritative [set] is not valid\r\n Set failed\r\n\r\n[edit]\r\r\nanurag@router03# "}

if I run the above lines directly via SSH in configure mode it works:

anurag@host:~$ configure
[edit]
anurag@host# set service dhcp-server shared-network-name LAN authoritative
[edit]
anurag@host# set service dhcp-server shared-network-name LAN subnet 192.168.100.0/24 default-router 192.168.100.1

[edit]
anurag@host# set service dhcp-server shared-network-name LAN subnet 192.168.100.0/24 dns-server 192.168.100.1
[edit]
anurag@host# set service dhcp-server shared-network-name LAN subnet 192.168.100.0/24 lease 86400
[edit]
anurag@host# set service dhcp-server shared-network-name LAN subnet 192.168.100.0/24 range 0 start 192.168.100.2
[edit]
anurag@host# set service dhcp-server shared-network-name LAN subnet 192.168.100.0/24 range 0 stop 192.168.100.254
[edit]
anurag@host#

[edit]
anurag@host# commit
[edit]
anurag@host#

Any idea what is wrong in the playbook?

Aah I was using wrong syntax.

Correct syntax which works:

  • name: Setup DNS server for eth3 - LAN with DHCP & Private IP
    vyos_config:
    lines:
  • set service dhcp-server shared-network-name LAN authoritative
  • set service dhcp-server shared-network-name LAN subnet 192.168.100.0/24 default-router 192.168.100.1
  • set service dhcp-server shared-network-name LAN subnet 192.168.100.0/24 dns-server 192.168.100.1
  • set service dhcp-server shared-network-name LAN subnet 192.168.100.0/24 lease 86400
  • set service dhcp-server shared-network-name LAN subnet 192.168.100.0/24 range 0 start 192.168.100.2
  • set service dhcp-server shared-network-name LAN subnet 192.168.100.0/24 range 0 stop 192.168.100.254

Sorry for the noise on the list!