1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-13 11:42:08 +00:00
iiab/roles/network/tasks/NM-debian.yml

88 lines
2.3 KiB
YAML
Raw Normal View History

2017-11-23 02:26:23 +00:00
# NM-debian.yml
2022-07-08 06:16:36 +00:00
#- name: Stopping services
# include_tasks: down-debian.yml
2017-11-23 02:30:10 +00:00
2017-11-23 02:26:23 +00:00
# provide keyfile layout like the XO's used way back.
2020-05-01 00:28:51 +00:00
#- name: Create uuid for NM's keyfile store
# shell: uuidgen
# register: uuid_response
2017-11-23 02:26:23 +00:00
2020-05-01 00:28:51 +00:00
#- name: Put the uuid in place
# set_fact:
# gen_uuid: "{{ uuid_response.stdout_lines[0] }}"
2017-11-23 02:26:23 +00:00
2020-05-01 00:28:51 +00:00
# systemd-networkd handles br0 except for Raspbian
- name: Remove stale br0 for NetworkManager
file:
dest: /etc/NetworkManager/system-connections/bridge-br0
state: absent
- name: Copy ap0-manage.conf for NetworkManager
template:
dest: /etc/NetworkManager/conf.d/ap0-manage.conf
src: network/ap0-manage.conf
mode: 0644
2023-04-20 15:43:18 +00:00
when: discovered_wireless_iface != "none" and wifi_up_down
2020-05-01 00:28:51 +00:00
- name: Copy manage.conf for NetworkManager when wifi_up_down False
2017-11-23 02:26:23 +00:00
template:
2020-04-30 05:56:38 +00:00
dest: /etc/NetworkManager/conf.d/wifi-manage.conf
src: network/manage.conf.j2
mode: 0644
when: discovered_wireless_iface != "none" and not wifi_up_down
2020-05-01 00:28:51 +00:00
- name: Remove manage.conf for NetworkManager when wifi_up_down True
2018-05-02 17:38:09 +00:00
file:
2020-05-01 00:28:51 +00:00
dest: /etc/NetworkManager/conf.d/wifi-manage.conf
2018-05-02 17:38:09 +00:00
state: absent
2020-05-01 00:28:51 +00:00
when: wifi_up_down
2018-05-02 17:38:09 +00:00
- 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: Use systemd-networkd to handle br0
set_fact:
systemd_networkd_active: True
when: iiab_lan_iface == "br0"
2017-11-23 02:26:23 +00:00
- name: Reload systemd
systemd:
daemon_reload: yes
2020-12-07 15:54:00 +00:00
when: not iiab_lan_iface == "br0"
2017-11-23 02:26:23 +00:00
2017-11-23 07:28:36 +00:00
- name: Restart the NetworkManager service
systemd:
name: NetworkManager
2017-11-23 02:26:23 +00:00
state: restarted
when: not nobridge is defined and not no_net_restart