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/main.yml
2020-03-04 17:00:01 -06:00

105 lines
3.7 KiB
YAML

- 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
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...
# /usr/libexec/iiab-startup.sh, iiab-hotspot-off & iiab-hotspot-on
#
# Separate Idea, Not Without Risks: should WiFi-as-gateway detection logic
# be encapsulated into roles/network/tasks/hostapd.yml in future? Whereas
# today "./runtags hostapd" doesn't exist & "./runtags AP" is UNSUPPORTED!
#- name: RPi - reboot to AP post install - installed via wifi so the services are ready
# set_fact:
# iiab_lan_iface: br0
# iiab_wan_iface: "{{ discovered_wired_iface }}"
# iiab_wireless_lan_iface: "{{ discovered_wireless_iface }}"
# iiab_wired_lan_iface: ""
# 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:
# no_net_restart: True
# 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
- name: (Re)Install named
include_tasks: named.yml
when: named_install and FQDN_changed and iiab_stage|int == 9
- name: (Re)Install dhcpd
include_tasks: dhcpd.yml
when: dhcpd_install and FQDN_changed and iiab_stage|int == 9
- name: (Re)Install Squid
include_tasks: squid.yml
when: squid_install and FQDN_changed and iiab_stage|int == 9
#### Start services
- include_tasks: avahi.yml
- include_tasks: computed_services.yml
- include_tasks: enable_services.yml
#### End services
#### Start network layout
- name: Redhat networking
include_tasks: ifcfg_mods.yml
when: is_redhat | bool
#and not installing
- name: Netplan in use on Ubuntu 18.04+
include_tasks: netplan.yml
when: is_ubuntu and not is_ubuntu_16
#when: is_ubuntu_18 | bool
#and not installing
- name: NetworkManager in use
include_tasks: NM-debian.yml
when: is_debuntu and network_manager_active
#and not installing
- name: systemd-networkd in use
include_tasks: sysd-netd-debian.yml
when: is_debuntu and systemd_networkd_active
#and not installing
- name: RPi's have dhcpcd in use
include_tasks: rpi_debian.yml
when: is_raspbian
#and not installing
- name: Not RPi, Not NetworkManager, Not systemd-networkd in use
include_tasks: debian.yml
when: (not is_raspbian and not network_manager_active and not systemd_networkd_active and is_debuntu) or is_ubuntu_16
#and not installing
#### end network layout
- include_tasks: restart.yml
when: not installing # REMOVE THIS LINE IF installing IS ALWAYS false AS SET IN roles/0-init/defaults/main.yml