bird/tasks/RedHat/8.yaml
2021-10-26 18:59:44 +03:00

58 lines
1.2 KiB
YAML

---
- name: Install BIRD
package:
name: bird
state: present
- block:
- name: Install network scripts
package:
name: network-scripts
state: present
- name: Update ifcfg-lo config
template:
src: ifcfg-lo.j2
dest: /etc/sysconfig/network-scripts/ifcfg-lo
notify:
- Restart loopback
when: network == 'ns'
- block:
- name: BGP IPs string for nmcli
set_fact:
ips: |-
{%- set ips_list = [] %}
{%- for protocol_static in bird.bgp.static %}
{%- for network in protocol_static['networks'][ansible_fqdn] %}
{{ ips_list.append(network['ip'] + '/' + network['mask_dash']) }}
{%- endfor %}
{%- endfor %}
{{ ips_list | join(', ') }}
- name: Add dummy interface and add IPs
community.general.nmcli:
type: dummy
conn_name: "{{ network_nm_iface }}"
ip4: "{{ ips }}"
mtu: "{{ network_nm_iface_mtu }}"
state: present
notify:
- Reload dummy interface
when: network == 'nm'
- name: Add BIRD config
template:
src: bird.conf.j2
dest: /etc/bird.conf
notify:
- Reload BIRD
- name: Start BIRD service
systemd:
name: bird
state: started
enabled: yes
daemon_reload: yes