2017-10-27 17:30:54 +00:00
|
|
|
- name: Stop the Access Point hostapd program
|
2018-04-07 21:45:04 +00:00
|
|
|
systemd:
|
|
|
|
name: hostapd
|
|
|
|
state: stopped
|
2017-06-09 23:25:56 +00:00
|
|
|
when: iiab_wireless_lan_iface != "none"
|
2017-05-27 18:09:50 +00:00
|
|
|
|
|
|
|
# might need an exclude for F18 here
|
|
|
|
- name: Now disconnect bridge slaves
|
|
|
|
shell: nmcli c delete id "System {{ item|trim }}"
|
|
|
|
ignore_errors: True
|
2017-06-09 23:25:56 +00:00
|
|
|
when: item|trim != iiab_wireless_lan_iface
|
2017-05-27 18:09:50 +00:00
|
|
|
with_items:
|
|
|
|
- "{{ ifcfg_slaves.stdout_lines }}"
|
|
|
|
|
|
|
|
# clear all bridge ifcfg files
|
|
|
|
- name: Now delete slave bridge ifcfg files
|
|
|
|
shell: rm -f /etc/sysconfig/network-scripts/ifcfg-"{{ item }}"
|
2018-03-30 23:02:31 +00:00
|
|
|
ignore_errors: True
|
2017-11-02 16:18:06 +00:00
|
|
|
when: num_lan_interfaces != 0 or iiab_wireless_lan_iface != "none"
|
2017-05-27 18:09:50 +00:00
|
|
|
with_items:
|
|
|
|
- "{{ ifcfg_slaves.stdout_lines }}"
|
|
|
|
|
|
|
|
- name: Now delete original ifcfg files
|
|
|
|
shell: rm -f /etc/sysconfig/network-scripts/ifcfg-"{{ item }}"
|
2017-11-02 16:18:06 +00:00
|
|
|
when: num_lan_interfaces == 1 and iiab_lan_iface != "br0"
|
2017-05-27 18:09:50 +00:00
|
|
|
with_items:
|
|
|
|
- "{{ discovered_lan_iface }}"
|
|
|
|
|
2018-07-17 05:48:19 +00:00
|
|
|
- name: BIND may be affected
|
|
|
|
service:
|
|
|
|
name: "{{ dns_service }}"
|
|
|
|
state: stopped
|
2017-09-13 11:07:25 +00:00
|
|
|
when: named_install and dnsmasq_enabled
|
|
|
|
|
|
|
|
- name: dhcpd_server may be affected - stopping dhcpd
|
2018-07-17 05:48:19 +00:00
|
|
|
service:
|
|
|
|
name: dhcpd
|
|
|
|
state: stopped
|
2019-05-24 07:06:43 +00:00
|
|
|
when: dhcpd_install | bool
|
2017-09-13 11:07:25 +00:00
|
|
|
|
|
|
|
- name: dhcpd_server may be affected - stopping dnsmasq
|
2018-07-17 05:48:19 +00:00
|
|
|
service:
|
|
|
|
name: dnsmasq
|
|
|
|
state: stopped
|
2019-05-24 07:06:43 +00:00
|
|
|
when: dnsmasq_install | bool
|
2017-09-13 11:07:25 +00:00
|
|
|
|
2017-06-09 23:25:56 +00:00
|
|
|
- name: Stop the LAN/Bridge deleting iiab-LAN
|
|
|
|
shell: nmcli con delete id iiab-LAN
|
2017-05-27 18:09:50 +00:00
|
|
|
ignore_errors: True
|
|
|
|
changed_when: False
|
2017-11-02 16:18:06 +00:00
|
|
|
when: (num_lan_interfaces != 0 or iiab_wireless_lan_iface != "none")
|
2017-05-27 18:09:50 +00:00
|
|
|
|
|
|
|
## vars/ users should set user_wan_iface to avoid messy redetect
|
2017-10-31 03:55:24 +00:00
|
|
|
- include_tasks: redetect.yml
|
2017-05-27 18:09:50 +00:00
|
|
|
when: discovered_wan_iface == "none" and user_wan_iface == "auto"
|
|
|
|
|
|
|
|
# move gateway if not WAN
|
|
|
|
# might have wifi info if wireless is used as uplink.
|
2017-10-31 03:55:24 +00:00
|
|
|
- include_tasks: edit_ifcfg.yml
|
2017-05-27 18:09:50 +00:00
|
|
|
when: has_wifi_gw == "none" and has_ifcfg_gw != "none" and has_ifcfg_gw != "/etc/sysconfig/network-scripts/ifcfg-WAN"
|
|
|
|
|
|
|
|
# create ifcfg-WAN if missing
|
|
|
|
# if we get here we have gateway but no ifcfg file
|
2017-11-02 16:18:06 +00:00
|
|
|
#- include_tasks: create_ifcfg.yml
|
|
|
|
# when: iiab_wan_iface != "none" and not has_WAN and has_ifcfg_gw == "none" and xo_model == "none" and not iiab_demo_mode
|
2017-05-27 18:09:50 +00:00
|
|
|
|
2017-06-09 23:25:56 +00:00
|
|
|
- name: Configuring LAN interface as iiab_lan_iface
|
2018-07-17 05:56:14 +00:00
|
|
|
template:
|
|
|
|
src: network/ifcfg.j2
|
|
|
|
dest: /etc/sysconfig/network-scripts/ifcfg-LAN
|
2017-06-09 23:25:56 +00:00
|
|
|
when: iiab_lan_iface != "none"
|
2017-05-27 18:09:50 +00:00
|
|
|
|
|
|
|
# can be more than one wired interface
|
|
|
|
- name: Wired enslaving ## lan_list_result ## to Bridge
|
2018-07-17 05:48:19 +00:00
|
|
|
template:
|
|
|
|
src: network/ifcfg-slave.j2
|
|
|
|
dest: "/etc/sysconfig/network-scripts/ifcfg-{{ item|trim }}"
|
2017-06-09 23:25:56 +00:00
|
|
|
when: iiab_lan_iface == "br0" and item|trim != iiab_wireless_lan_iface and item|trim != iiab_wan_iface
|
2017-05-27 18:09:50 +00:00
|
|
|
with_items:
|
2018-07-17 05:48:19 +00:00
|
|
|
- "{{ lan_list_result.stdout_lines }}"
|
2017-05-27 18:09:50 +00:00
|
|
|
|
2017-06-09 23:25:56 +00:00
|
|
|
- name: WiFi enslaving {{ iiab_wireless_lan_iface }} to Bridge
|
2018-07-17 05:48:19 +00:00
|
|
|
template:
|
|
|
|
src: network/wifi-slave.j2
|
|
|
|
dest: "/etc/sysconfig/network-scripts/ifcfg-{{ iiab_wireless_lan_iface }}"
|
2017-06-09 23:25:56 +00:00
|
|
|
when: iiab_lan_iface == "br0" and iiab_wireless_lan_iface != "none"
|
2017-05-27 18:09:50 +00:00
|
|
|
tags:
|
|
|
|
- network
|
|
|
|
|
2017-10-31 03:55:24 +00:00
|
|
|
- include_tasks: enable_wan.yml
|
2017-06-09 23:25:56 +00:00
|
|
|
when: not installing and not iiab_demo_mode
|
2017-05-27 18:09:50 +00:00
|
|
|
|
2018-07-17 05:48:19 +00:00
|
|
|
- name: Ask systemd to reread the unit files, picks up changes done
|
2018-04-07 21:45:04 +00:00
|
|
|
systemd:
|
|
|
|
daemon_reload: yes
|
2017-09-09 21:12:05 +00:00
|
|
|
when: not installing
|
|
|
|
|
2017-05-27 18:09:50 +00:00
|
|
|
# monitor-connection-files defaults to no with F21, F18-F20 defaults to yes
|
|
|
|
- name: Re-read network config files
|
|
|
|
shell: nmcli con reload
|
|
|
|
when: not installing and not no_NM_reload
|
|
|
|
|
|
|
|
# test point, we should always have one with any kind of starting point
|
|
|
|
# no ifcfg = supply
|
|
|
|
# had but not WAN = rename and edit if wired, skip wifi gateway.
|
|
|
|
# test point, confirm onboot=no is OK everywhere
|
|
|
|
|
|
|
|
- name: Enabling pre-existing ifcfg-WAN file
|
2017-06-09 23:25:56 +00:00
|
|
|
shell: nmcli conn up id iiab-WAN
|
|
|
|
when: has_WAN and iiab_wan_iface != "none" and not installing and not iiab_demo_mode
|
2017-05-27 18:09:50 +00:00
|
|
|
|
|
|
|
- name: Enabling ifcfg-LAN file
|
2017-06-09 23:25:56 +00:00
|
|
|
shell: nmcli conn up id iiab-LAN
|
2017-05-27 18:09:50 +00:00
|
|
|
ignore_errors: True
|
2017-06-09 23:25:56 +00:00
|
|
|
when: iiab_lan_iface != "none" and not installing and not iiab_demo_mode
|
2017-05-27 18:09:50 +00:00
|
|
|
|
2017-10-19 06:33:02 +00:00
|
|
|
# we could do the DEVICE name stuff for a cleaner looking nmcli
|
2017-05-27 18:09:50 +00:00
|
|
|
- name: Enabling ifcfg slaves
|
|
|
|
shell: nmcli conn up id "System {{ item|trim }}"
|
|
|
|
ignore_errors: True
|
2017-06-09 23:25:56 +00:00
|
|
|
when: iiab_lan_iface == "br0" and item|trim != iiab_wireless_lan_iface and item|trim != iiab_wan_iface and not iiab_demo_mode
|
2017-05-27 18:09:50 +00:00
|
|
|
with_items:
|
2018-07-17 05:48:19 +00:00
|
|
|
- "{{ lan_list_result.stdout_lines }}"
|
2017-05-27 18:09:50 +00:00
|
|
|
|
2017-11-01 14:59:33 +00:00
|
|
|
#- name: restart hostapd when wifi is present
|
|
|
|
# service: name=hostapd state=started
|
|
|
|
# when: iiab_wireless_lan_iface != "none" and hostapd_enabled and iiab_network_mode != "Appliance"
|
2017-09-15 16:56:57 +00:00
|
|
|
|
2017-11-01 14:59:33 +00:00
|
|
|
#- name: dhcp_server may be affected - starting - user choice
|
|
|
|
# service: name={{ dhcp_service2 }} state=started
|