---
- name: install GPG
  apt:
    name: gnupg

- name: Add FRR repo key
  apt_key:
    data: "{{ lookup('file', 'frr-apt-key.asc') }}"
    state: present

- name: Add FRR apt repository
  apt_repository:
    repo: deb https://deb.frrouting.org/frr buster frr-stable
    state: present
  notify: restart frr

- name: Install frr
  apt:
    name: frr

- name: setup frr daemons
  template:
    src: daemons.j2
    dest: /etc/frr/daemons
    mode: 0644
  notify: restart frr

- name: setup frr.conf
  template:
    src: frr.conf.j2
    dest: /etc/frr/frr.conf
    mode: 0644
  notify: restart frr

- name: enable+start frr
  service:
    name: frr
    state: started
    enabled: true