mirror of
https://github.com/iiab/iiab.git
synced 2025-02-15 04:32:11 +00:00
NetworkManager support for wan static ip address
This commit is contained in:
parent
e7fc6cc36d
commit
450a346839
2 changed files with 54 additions and 0 deletions
|
@ -17,6 +17,7 @@
|
||||||
dest: /etc/NetworkManager/system-connections/
|
dest: /etc/NetworkManager/system-connections/
|
||||||
src: network/bridge-br0
|
src: network/bridge-br0
|
||||||
mode: 0600
|
mode: 0600
|
||||||
|
when: iiab_network_mode != "Appliance"
|
||||||
|
|
||||||
- name: Remove br0 in Appliance Mode for NetworkManager
|
- name: Remove br0 in Appliance Mode for NetworkManager
|
||||||
file:
|
file:
|
||||||
|
@ -24,6 +25,39 @@
|
||||||
state: absent
|
state: absent
|
||||||
when: iiab_network_mode == "Appliance"
|
when: iiab_network_mode == "Appliance"
|
||||||
|
|
||||||
|
- name: Removing static for NetworkManager
|
||||||
|
file:
|
||||||
|
dest: /etc/NetworkManager/system-connections/iiab-static
|
||||||
|
state: absent
|
||||||
|
when: wan_ip == "dhcp"
|
||||||
|
|
||||||
|
- name: Static IP computing CIDR
|
||||||
|
shell: netmask {{ wan_ip }}/{{ wan_netmask }} | awk -F "/" '{print $2}'
|
||||||
|
register: CIDR
|
||||||
|
when: wan_ip != "dhcp"
|
||||||
|
|
||||||
|
- name: Static IP setting CIDR
|
||||||
|
set_fact:
|
||||||
|
wan_cidr: "{{ CIDR.stdout }}"
|
||||||
|
when: wan_ip != "dhcp"
|
||||||
|
|
||||||
|
- name: Create uuid for NM's keyfile store static
|
||||||
|
shell: uuidgen
|
||||||
|
register: uuid_response2
|
||||||
|
when: wan_ip != "dhcp"
|
||||||
|
|
||||||
|
- name: Put the uuid in place
|
||||||
|
set_fact:
|
||||||
|
gen_uuid2: "{{ uuid_response2.stdout_lines[0] }}"
|
||||||
|
when: wan_ip != "dhcp"
|
||||||
|
|
||||||
|
- name: Copy static template for NetworkManager
|
||||||
|
template:
|
||||||
|
dest: /etc/NetworkManager/system-connections/iiab-static
|
||||||
|
src: network/NM-static.j2
|
||||||
|
mode: 0600
|
||||||
|
when: wan_ip != "dhcp"
|
||||||
|
|
||||||
- name: Stop wpa_supplicant service
|
- name: Stop wpa_supplicant service
|
||||||
service:
|
service:
|
||||||
name: wpa_supplicant
|
name: wpa_supplicant
|
||||||
|
|
20
roles/network/templates/network/NM-static.j2
Normal file
20
roles/network/templates/network/NM-static.j2
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
[connection]
|
||||||
|
id=iiab-wan-static
|
||||||
|
uuid={{ gen_uuid2 }}
|
||||||
|
type=802-3-ethernet
|
||||||
|
interface-name={{ iiab_wan_device }}
|
||||||
|
permissions=
|
||||||
|
|
||||||
|
[ipv4]
|
||||||
|
method=manual
|
||||||
|
dns={{ wan_nameserver }};
|
||||||
|
dns-search={{ iiab_domain }};
|
||||||
|
addresses1={{ wan_ip }};{{ wan_cidr }};{{ wan_gateway }};
|
||||||
|
may-fail=true
|
||||||
|
|
||||||
|
[802-3-ethernet]
|
||||||
|
duplex=full
|
||||||
|
|
||||||
|
[ipv6]
|
||||||
|
method=link-local
|
||||||
|
may-fail=true
|
Loading…
Reference in a new issue