---

- name: standardise dir ownership
  file:
    path: /etc/bird
    state: directory
    owner: admin
    group: bird
    mode: 0750

- name: standardise file ownerships
  file:
    path: "{{b_item}}"
    state: touch
    owner: admin
    group: bird
    mode: 0750
  with_items:
  - /etc/bird/bird.conf
  - /etc/bird/mwu_peers_v4.inc
  - /etc/bird/ffrl_peers_v4.inc
  - /etc/bird/icvpn_peers_v4.inc
  - /etc/bird/icvpn_roa_v4.inc
  - /etc/bird/bird6.conf
  - /etc/bird/icvpn_peers_v6.inc
  - /etc/bird/icvpn_roa_v6.inc
  - /etc/bird/mwu_peers_v6.inc
  - /etc/bird/ffrl_peers_v6.inc
  loop_control:
    loop_var: b_item

- name: template out bird.confs
  template:
    backup: yes
    dest: /etc/bird/{{b_item}}
    src: "{{b_item}}"
    #validate !!!
  with_items:
  - bird.conf
  - bird6.conf
  loop_control:
    loop_var: b_item

# FIXME: construct mwu includes

# FIXME: construct ffrl includes