mirror of
https://gitea.0xace.cc/ansible-galaxy/bird.git
synced 2024-11-24 23:56:38 +00:00
fix nmcli
This commit is contained in:
parent
246441558a
commit
feab9fb4a3
@ -2,3 +2,6 @@
|
|||||||
# use 'network-scripts' for network-scripts and lo iface for BGP IPs
|
# use 'network-scripts' for network-scripts and lo iface for BGP IPs
|
||||||
network: "nm"
|
network: "nm"
|
||||||
network_nm_iface: "dummy0"
|
network_nm_iface: "dummy0"
|
||||||
|
|
||||||
|
# null for auto
|
||||||
|
network_nm_iface_mtu: null
|
||||||
|
@ -18,20 +18,25 @@
|
|||||||
- Restart loopback
|
- Restart loopback
|
||||||
when: network == 'network-scripts'
|
when: network == 'network-scripts'
|
||||||
|
|
||||||
- name: Add dummy interface and add IPs
|
|
||||||
|
- 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:
|
community.general.nmcli:
|
||||||
type: dummy
|
type: dummy
|
||||||
conn_name: "{{ network_nm_iface }}"
|
conn_name: "{{ network_nm_iface }}"
|
||||||
ip4: |
|
ip4: "{{ ips }}"
|
||||||
[
|
mtu: "{{ network_nm_iface_mtu }}"
|
||||||
{% set ips = [] %}
|
|
||||||
{% for protocol_static in bird.bgp.static %}
|
|
||||||
{% for network in protocol_static['networks'][ansible_fqdn] %}
|
|
||||||
{{ ips.append(network['ip'] + '/' + network['mask_dash']) }}
|
|
||||||
{% endfor %}
|
|
||||||
{% endfor %}
|
|
||||||
"{{ ips | join(',') }}"
|
|
||||||
]
|
|
||||||
state: present
|
state: present
|
||||||
notify:
|
notify:
|
||||||
- Reload dummy interface
|
- Reload dummy interface
|
||||||
@ -50,4 +55,3 @@
|
|||||||
state: started
|
state: started
|
||||||
enabled: yes
|
enabled: yes
|
||||||
daemon_reload: yes
|
daemon_reload: yes
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user