mirror of
https://github.com/iiab/iiab.git
synced 2025-02-13 11:42:08 +00:00
71 lines
2.1 KiB
YAML
71 lines
2.1 KiB
YAML
# rpi_debian.yml
|
|
# Start out making simplifying assumptions
|
|
# 1. we are dealing with a rpi3
|
|
# 2. Gui inputs define the config -- auto config is more difficult
|
|
# a. gui_desired_network_role
|
|
# b. hostapd_enabled
|
|
# c. gui_static_wan_ip
|
|
# 3. In appliance mode: wan is either wired dhcp/static or wlan0 and hostapd off
|
|
# 4. In lan_controller: wan is off, eth0 and wlan0 under br0
|
|
# 5. In gateway: user gateway is wan, and wlan0 under br0 if not acting as
|
|
# the gateway
|
|
|
|
- name: Supply resolvconf.conf
|
|
template:
|
|
dest: /etc/resolvconf.conf
|
|
src: network/resolvconf.j2
|
|
|
|
- name: Supply dhcpcd.conf
|
|
template:
|
|
dest: /etc/dhcpcd.conf
|
|
src: network/dhcpcd.conf.j2
|
|
|
|
- name: New raspbian requires counry code -- check for it
|
|
shell: grep country /etc/wpa_supplicant/wpa_supplicant.conf
|
|
register: country_code
|
|
|
|
- name: Put a country code if it does not exist
|
|
lineinfile:
|
|
dest: /etc/wpa_supplicant/wpa_supplicant.conf
|
|
regexp: "^country.*"
|
|
line: country={{ host_country_code }}
|
|
when: country_code.stdout == ""
|
|
|
|
- name: Copy the bridge script for RPi
|
|
template:
|
|
dest: /etc/network/interfaces.d/iiab
|
|
src: network/iiab.j2
|
|
when: iiab_lan_iface == "br0"
|
|
|
|
- name: Stopping services
|
|
include_tasks: down-debian.yml
|
|
|
|
- name: Reload systemd
|
|
shell: systemctl daemon-reload
|
|
|
|
# now pick up denyinterfaces
|
|
- name: Restart dhcpcd
|
|
service:
|
|
name: dhcpcd
|
|
state: restarted
|
|
|
|
- name: Restart the networking service if appropriate
|
|
service:
|
|
name: networking
|
|
enabled: yes
|
|
state: restarted
|
|
when: not nobridge is defined and not no_net_restart
|
|
|
|
- name: Restart hostapd if appropriate
|
|
service:
|
|
name: hostapd
|
|
state: restarted
|
|
when: hostapd_enabled and iiab_wan_iface != discoveed_wireless_iface and iiab_network_mode != "Appliance"
|
|
|
|
- name: Ansible is having a problem enabling services
|
|
shell: systemctl enable hostapd
|
|
when: hostapd_enabled and iiab_wan_iface != discoveed_wireless_iface and iiab_network_mode != "Appliance"
|
|
|
|
#- name: dhcp_server may be affected - starting - user choice
|
|
# service: name={{ dhcp_service2 }} state=started
|
|
# when: iiab_network_mode != "Appliance"
|