diff --git a/handlers/main.yml b/handlers/main.yml index a45f942..5cb6133 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -1,14 +1,19 @@ --- -- name: restart bird +- name: Restart BIRD systemd: name: bird state: restarted daemon_reload: yes -- name: restart loopback +- name: Reload BIRD + systemd: + name: bird + state: restarted + daemon_reload: yes + +- name: Restart loopback shell: | ifdown lo ; ifup lo - -- name: reload dummy interface +- name: Reload dummy interface command: nmcli conn up lo0 diff --git a/tasks/RedHat/7.yaml b/tasks/RedHat/7.yaml index 5ef9cb1..88687bf 100644 --- a/tasks/RedHat/7.yaml +++ b/tasks/RedHat/7.yaml @@ -1,24 +1,24 @@ --- -- name: install bird +- name: Install BIRD package: name: bird2 state: present -- name: add bird config +- name: Add BIRD config template: src: bird.conf.j2 dest: /etc/bird.conf notify: - - restart bird + - reload bird -- name: update ifcfg-lo config +- name: Update ifcfg-lo config template: src: ifcfg-lo.j2 dest: /etc/sysconfig/network-scripts/ifcfg-lo notify: - - restart loopback + - Restart loopback -- name: start bird service +- name: Start BIRD service systemd: name: bird state: started diff --git a/tasks/RedHat/8.yaml b/tasks/RedHat/8.yaml index 87c3291..fe32348 100644 --- a/tasks/RedHat/8.yaml +++ b/tasks/RedHat/8.yaml @@ -1,30 +1,39 @@ --- -- name: Install bird - package: +- name: Install BIRD + package: name: bird state: present -- name: Add bird config +- name: Add BIRD config template: src: bird.conf.j2 dest: /etc/bird.conf notify: - - restart bird + - reload bird - name: Add dummy interface and add IPs community.general.nmcli: - type: lo0 + type: dummy conn_name: 'lo0' - ip4: '{{ item.ip }}' - gw4: '{{ item.gw }}' + ip4: '{{ item.ip4 }}' state: present notify: - reload dummy interface - loop: '{{ bird.bgp.static|subelements(networks[ansible_fqdn]) }}' + loop: | + [ + {% for protocol_static in bird.bgp.static %} + {% for network in protocol_static['networks'][ansible_fqdn] %} + { + "ip4": "{{ network['ip'] + '/' + network['mask_dash'] }}" + }, + {% endfor %} + {% endfor %} + ] -- name: start bird service +- name: Start BIRD service systemd: name: bird state: started enabled: yes daemon_reload: yes +