update role - fix loopback for el8

This commit is contained in:
ace 2021-10-25 15:26:23 +03:00
parent 5de53a9171
commit 7a2bb34f17
No known key found for this signature in database
GPG Key ID: 2E47CC17BA7F8CF0
3 changed files with 33 additions and 19 deletions

View File

@ -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

View File

@ -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

View File

@ -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