mirror of
https://gitea.0xace.cc/ansible-galaxy/bird.git
synced 2025-01-18 20:12:20 +00:00
fix network-scripts and nmcli variants for loopback interface
This commit is contained in:
parent
359d858e60
commit
fd0c9bd34f
4
defaults/main.yaml
Normal file
4
defaults/main.yaml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
# use 'nm' for network-manager and dummy0 iface for BGP IPs
|
||||||
|
# use 'network-scripts' for network-scripts and lo iface for BGP IPs
|
||||||
|
network: "nm"
|
||||||
|
network_nm_iface: "dummy0"
|
@ -16,4 +16,4 @@
|
|||||||
ifdown lo ; ifup lo
|
ifdown lo ; ifup lo
|
||||||
|
|
||||||
- name: Reload dummy interface
|
- name: Reload dummy interface
|
||||||
command: nmcli conn up {{ dummy_iface | default('dummy0') }}
|
command: nmcli conn up {{ network_nm_iface }}
|
||||||
|
@ -1,39 +1,41 @@
|
|||||||
---
|
---
|
||||||
- name: Install network scripts
|
|
||||||
package:
|
|
||||||
name: network-scripts
|
|
||||||
state: present
|
|
||||||
|
|
||||||
- name: Install BIRD
|
- name: Install BIRD
|
||||||
package:
|
package:
|
||||||
name: bird
|
name: bird
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
|
- block:
|
||||||
|
- name: Install network scripts
|
||||||
|
package:
|
||||||
|
name: network-scripts
|
||||||
|
state: present
|
||||||
|
|
||||||
- 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
|
||||||
|
when: network == 'network-scripts'
|
||||||
|
|
||||||
#- name: Add dummy interface and add IPs
|
- name: Add dummy interface and add IPs
|
||||||
# community.general.nmcli:
|
community.general.nmcli:
|
||||||
# type: dummy
|
type: dummy
|
||||||
# conn_name: "{{ dummy_iface | default('dummy0') }}"
|
conn_name: "{{ network_nm_iface }}"
|
||||||
# ip4: '{{ item.ip4 }}'
|
ip4: |
|
||||||
# state: present
|
[
|
||||||
# notify:
|
{% set ips = [] %}
|
||||||
# - Reload dummy interface
|
{% for protocol_static in bird.bgp.static %}
|
||||||
# loop: |
|
{% for network in protocol_static['networks'][ansible_fqdn] %}
|
||||||
# [
|
{{ ips.append(network['ip'] + '/' + network['mask_dash']) }}
|
||||||
# {% for protocol_static in bird.bgp.static %}
|
{% endfor %}
|
||||||
# {% for network in protocol_static['networks'][ansible_fqdn] %}
|
{% endfor %}
|
||||||
# {
|
"{{ ips | join(',') }}"
|
||||||
# "ip4": "{{ network['ip'] + '/' + network['mask_dash'] }}"
|
]
|
||||||
# },
|
state: present
|
||||||
# {% endfor %}
|
notify:
|
||||||
# {% endfor %}
|
- Reload dummy interface
|
||||||
# ]
|
when: network == 'nm'
|
||||||
|
|
||||||
- name: Add BIRD config
|
- name: Add BIRD config
|
||||||
template:
|
template:
|
||||||
|
Loading…
Reference in New Issue
Block a user