diff --git a/roles/network/tasks/NM.yml b/roles/network/tasks/fedora/NM.yml similarity index 100% rename from roles/network/tasks/NM.yml rename to roles/network/tasks/fedora/NM.yml diff --git a/roles/network/tasks/fedora/create_ifcfg.yml.deprecated b/roles/network/tasks/fedora/create_ifcfg.yml.deprecated new file mode 100644 index 000000000..7c982dbd2 --- /dev/null +++ b/roles/network/tasks/fedora/create_ifcfg.yml.deprecated @@ -0,0 +1,17 @@ +- name: Stop 'Wired WAN connection' + shell: nmcli dev disconnect {{ discovered_wan_iface }} + ignore_errors: True + changed_when: False + when: discovered_wan_iface != "none" and not has_WAN and has_ifcfg_gw == "none" + +# set user_wan_iface: for static +# use wan_* for static info +- name: Supply ifcfg-WAN file + template: src=network/ifcfg-WAN.j2 + dest=/etc/sysconfig/network-scripts/ifcfg-WAN + when: iiab_wan_iface != "none" and not has_WAN and has_ifcfg_gw == "none" + +- name: Now setting ifcfg-WAN True after creating file + set_fact: + has_WAN: True + when: iiab_wan_iface != "none" and has_ifcfg_gw == "none" diff --git a/roles/network/tasks/detected_redhat.yml b/roles/network/tasks/fedora/detected_redhat.yml similarity index 100% rename from roles/network/tasks/detected_redhat.yml rename to roles/network/tasks/fedora/detected_redhat.yml diff --git a/roles/network/tasks/edit_ifcfg.yml b/roles/network/tasks/fedora/edit_ifcfg.yml similarity index 100% rename from roles/network/tasks/edit_ifcfg.yml rename to roles/network/tasks/fedora/edit_ifcfg.yml diff --git a/roles/network/tasks/enable_wan.yml b/roles/network/tasks/fedora/enable_wan.yml similarity index 100% rename from roles/network/tasks/enable_wan.yml rename to roles/network/tasks/fedora/enable_wan.yml diff --git a/roles/network/tasks/fedora/hosts.yml.deprecated b/roles/network/tasks/fedora/hosts.yml.deprecated new file mode 100644 index 000000000..ce4a7467f --- /dev/null +++ b/roles/network/tasks/fedora/hosts.yml.deprecated @@ -0,0 +1,28 @@ +# this (hosts.yml) WAS invoked by roles/network/tasks/main.yml up until 2019-12-10 + +#TODO: Use vars instead of hardcoded values +- name: Remove FQDN with 172.18.96.1 in /etc/hosts without LAN (if iiab_lan_iface == "none" and not installing) + lineinfile: + path: /etc/hosts + regexp: '^172\.18\.96\.1' + state: absent + when: iiab_lan_iface == "none" and not installing + +- name: Configure FQDN with 172.18.96.1 in /etc/hosts with LAN (if iiab_lan_iface != "none" and not installing) + lineinfile: + path: /etc/hosts + regexp: '^172\.18\.96\.1' + line: '172.18.96.1 {{ iiab_hostname }}.{{ iiab_domain }} {{ iiab_hostname }} box box.lan' + state: present + when: not (iiab_lan_iface == "none") and not installing + +# roles/0-init/tasks/hostname.yml ALSO does this: +- name: 'Put FQDN & hostnames in /etc/hosts: "127.0.0.1 {{ iiab_hostname }}.{{ iiab_domain }} localhost.localdomain localhost {{ iiab_hostname }} box box.lan" (if iiab_lan_iface == "none" and not installing, appliance mode?)' + lineinfile: + path: /etc/hosts + regexp: '^127\.0\.0\.1' + line: '127.0.0.1 {{ iiab_hostname }}.{{ iiab_domain }} localhost.localdomain localhost {{ iiab_hostname }} box box.lan' + owner: root + group: root + mode: 0644 + when: iiab_lan_iface == "none" and not installing diff --git a/roles/network/tasks/ifcfg_mods.yml b/roles/network/tasks/fedora/ifcfg_mods.yml similarity index 100% rename from roles/network/tasks/ifcfg_mods.yml rename to roles/network/tasks/fedora/ifcfg_mods.yml diff --git a/roles/network/tasks/redetect.yml b/roles/network/tasks/fedora/redetect.yml similarity index 100% rename from roles/network/tasks/redetect.yml rename to roles/network/tasks/fedora/redetect.yml diff --git a/roles/network/tasks/static.yml b/roles/network/tasks/fedora/static.yml similarity index 100% rename from roles/network/tasks/static.yml rename to roles/network/tasks/fedora/static.yml diff --git a/roles/network/tasks/main.yml b/roles/network/tasks/main.yml index e73b12eea..486532cae 100644 --- a/roles/network/tasks/main.yml +++ b/roles/network/tasks/main.yml @@ -1,12 +1,12 @@ - include_tasks: detected_network.yml - when: not installing # REMOVE THIS LINE IF installing IS ALWAYS false AS SET IN roles/0-init/defaults/main.yml - name: IF WIFI IS PRIMARY GATEWAY, PLEASE RUN 'iiab-hotspot-on' MANUALLY set_fact: hostapd_enabled: False # used in (1) hostapd.yml, (2) rpi_debian.yml + # (3) its dhcpcd.conf.j2, (4) restart.yml no_net_restart: True # used below in (1) sysd-netd-debian.yml, - # (2) debian.yml, (3) rpi_debian.yml + # (2) debian.yml, (3) rpi_debian.yml, + # (4) NM-debian.yml when: discovered_wireless_iface == iiab_wan_iface and not reboot_to_AP # EITHER WAY: hostapd_enabled's state is RECORDED into {{ iiab_env_file }} # in hostapd.yml for later use by... @@ -25,9 +25,6 @@ # when: is_raspbian and discovered_wireless_iface is defined and discovered_wireless_iface == iiab_wan_iface and reboot_to_AP - include_tasks: computed_network.yml - when: not installing #REMOVE THIS LINE IF installing IS ALWAYS false AS SET IN roles/0-init/defaults/main.yml - -- include_tasks: hostapd.yml #- name: RPi - don't reboot to AP post install - installed via wifi - don't blow away current network # set_fact: @@ -35,13 +32,6 @@ # hostapd_enabled: False # when: is_raspbian and discovered_wireless_iface is defined and discovered_wired_iface != iiab_wan_iface -##### Start static ip address info for first run ##### -#- include_tasks: static.yml -# when: 'iiab_wan_iface != "none" and wan_ip != "dhcp"' -##### End static ip address info - -#- include_tasks: hosts.yml - - name: Configure wondershaper include_tasks: wondershaper.yml when: wondershaper_install or wondershaper_installed is defined @@ -63,6 +53,7 @@ - include_tasks: avahi.yml - include_tasks: computed_services.yml - include_tasks: enable_services.yml +- include_tasks: hostapd.yml #### End services