1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-13 19:52:06 +00:00
iiab/roles/network/tasks/main.yml
2018-04-04 04:16:51 -04:00

175 lines
5 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
tags:
- network #REMOVE SUCH LINES (BELOW TOO) AS WE'RE IN "network" ?
- network-discover
- 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 /etc/iiab/iiab.env
# (happens just below) 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: Record HOSTAPD_ENABLED to /etc/iiab/iiab.env
lineinfile:
dest: /etc/iiab/iiab.env
regexp: '^HOSTAPD_ENABLED=*'
line: 'HOSTAPD_ENABLED={{ hostapd_enabled }}'
state: present
#when: not installing #REMOVE THIS LINE IF installing IS ALWAYS false AS SET IN roles/0-init/defaults/main.yml
tags:
- network
#- 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_rpi 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
tags:
- network
- network-discover
- include_tasks: hostapd.yml
tags:
- network
- AP
#- 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_rpi 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
tags:
- network
- hostname
- domain
- name: Configuring wondershaper
include_tasks: wondershaper.yml
when: wondershaper_install
tags:
- network
- wondershaper
- name: (Re)Installing named
include_tasks: named.yml
when: FQDN_changed and iiab_stage|int == 9
- name: (Re)Installing dhcpd
include_tasks: dhcpd.yml
when: FQDN_changed and iiab_stage|int == 9
- name: (Re)Installing Squid
include_tasks: squid.yml
when: FQDN_changed and squid_install and iiab_stage|int == 9
#### start services
- include_tasks: avahi.yml
tags:
- network
- include_tasks: computed_services.yml
tags:
- network
- named
- dhcpd
- dnsmasq
- squid
- include_tasks: enable_services.yml
tags:
- network
- named
- dhcpd
- dnsmasq
- squid
#### end services
#### Start network layout
- name: Redhat networking
include_tasks: ifcfg_mods.yml
when: is_redhat
#and not installing
tags:
- network
- name: NetworkManager in use
include_tasks: NM-debian.yml
when: is_debuntu and network_manager_active
#and not installing
tags:
- network
- name: systemd-networkd in use
include_tasks: sysd-netd-debian.yml
when: is_debuntu and systemd_networkd_active
#and not installing
tags:
- network
- name: RPi's have dhcpcd in use
include_tasks: rpi_debian.yml
when: is_debuntu and is_rpi
#and not installing
tags:
- network
- name: Not RPi, Not NetworkManager, Not systemd-networkd in use
include_tasks: debian.yml
when: not is_rpi and not network_manager_active and not systemd_networkd_active and is_debuntu
#and not installing
tags:
- network
# this is moving
- name: Record IIAB_WAN_DEVICE to /etc/iiab/iiab.env
lineinfile:
dest: /etc/iiab/iiab.env
regexp: '^IIAB_WAN_DEVICE=*'
line: 'IIAB_WAN_DEVICE="{{ iiab_wan_iface }}"'
state: present
when: not installing #REMOVE THIS LINE IF installing IS ALWAYS false AS SET IN roles/0-init/defaults/main.yml
tags:
- network
- name: Record IIAB_LAN_DEVICE to /etc/iiab/iiab.env
lineinfile:
dest: /etc/iiab/iiab.env
regexp: '^IIAB_LAN_DEVICE=*'
line: 'IIAB_LAN_DEVICE="{{ iiab_lan_iface }}"'
state: present
when: not installing #REMOVE THIS LINE IF installing IS ALWAYS false AS SET IN roles/0-init/defaults/main.yml
tags:
- network
#### end network layout
- include_tasks: restart.yml
when: not installing
tags:
- network
- named
- dhcpd
- dnsmasq
- squid
- AP