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!
On Fri, Dec 28, 2018 at 1:38 AM Anurag Bhatia <[email protected]> wrote:
> 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?
>
>
>
>
> --
>
>
> Anurag Bhatia
> anuragbhatia.com
>
--
Anurag Bhatia
anuragbhatia.com
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/CAJ0%2BaXaDaSbLVy%3DXDnuDvJ-cnxgd4c-Rb3b4k0D8m0mpoWr42A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.