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: systemd:
name: bird name: bird
state: restarted state: restarted
daemon_reload: yes daemon_reload: yes
- name: restart loopback - name: Reload BIRD
systemd:
name: bird
state: restarted
daemon_reload: yes
- name: Restart loopback
shell: | shell: |
ifdown lo ; ifup lo ifdown lo ; ifup lo
- name: Reload dummy interface
- name: reload dummy interface
command: nmcli conn up lo0 command: nmcli conn up lo0

View File

@ -1,24 +1,24 @@
--- ---
- name: install bird - name: Install BIRD
package: package:
name: bird2 name: bird2
state: present state: present
- name: add bird config - name: Add BIRD config
template: template:
src: bird.conf.j2 src: bird.conf.j2
dest: /etc/bird.conf dest: /etc/bird.conf
notify: notify:
- restart bird - reload bird
- name: update ifcfg-lo config - name: Update ifcfg-lo config
template: template:
src: ifcfg-lo.j2 src: ifcfg-lo.j2
dest: /etc/sysconfig/network-scripts/ifcfg-lo dest: /etc/sysconfig/network-scripts/ifcfg-lo
notify: notify:
- restart loopback - Restart loopback
- name: start bird service - name: Start BIRD service
systemd: systemd:
name: bird name: bird
state: started state: started

View File

@ -1,30 +1,39 @@
--- ---
- name: Install bird - name: Install BIRD
package: package:
name: bird name: bird
state: present state: present
- name: Add bird config - name: Add BIRD config
template: template:
src: bird.conf.j2 src: bird.conf.j2
dest: /etc/bird.conf dest: /etc/bird.conf
notify: notify:
- restart bird - reload bird
- name: Add dummy interface and add IPs - name: Add dummy interface and add IPs
community.general.nmcli: community.general.nmcli:
type: lo0 type: dummy
conn_name: 'lo0' conn_name: 'lo0'
ip4: '{{ item.ip }}' ip4: '{{ item.ip4 }}'
gw4: '{{ item.gw }}'
state: present state: present
notify: notify:
- reload dummy interface - 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: systemd:
name: bird name: bird
state: started state: started
enabled: yes enabled: yes
daemon_reload: yes daemon_reload: yes