# We should just apt install it but we need features not in released
# version. Also the cumulus package is two versions behind.
- name: Install radvd
  block:
  - name: Install deps for radvd
    package:
      name: autoconf,automake,bison,build-essential,flex,gettext,libtool,pkg-config,libbsd-dev,libbsd0
      update_cache: true

  - name: Checkout radvd source
    git:
      repo: https://github.com/radvd-project/radvd
      dest: /usr/local/src/radvd
      version: f67335b5335b6ed5ca68d6fa71c08cccb4f3a629

  - name: Build and install radvd
    shell: |
      ./autogen.sh
      ./configure --without-check
      make
      make install
    args:
      chdir: /usr/local/src/radvd
      creates: /usr/local/sbin/radvd

- name: Configure radvd
  template:
    dest: /etc/radvd.conf
    src: radvd.conf.j2
    mode: 0644
  notify: restart radvd

- name: Enable radvd
  service:
    name: radvd
    enabled: true
    state: started