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/rpi_debian.yml

77 lines
2.2 KiB
YAML
Raw Normal View History

2017-05-27 18:09:50 +00:00
# rpi_debian.yml
# Start out making simplifying assumptions
2017-05-27 18:09:50 +00:00
# 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
2017-11-22 19:10:53 +00:00
# 3. In appliance mode: wan is either wired dhcp/static or wlan0 and hostapd off
2017-05-27 18:09:50 +00:00
# 4. In lan_controller: wan is off, eth0 and wlan0 under br0
2017-11-22 19:10:53 +00:00
# 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
2018-03-30 00:17:56 +00:00
ignore_errors: True
- 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 }}
2018-03-30 00:17:56 +00:00
when: country_code is defined and country_code.stdout == ""
- name: Enable the wifi with rfkill
shell: rfkill unblock 0
ignore_errors: True
2017-11-22 19:10:53 +00:00
- name: Copy the bridge script for RPi
template:
dest: /etc/network/interfaces.d/iiab
src: network/iiab.j2
2017-11-22 19:10:53 +00:00
when: iiab_lan_iface == "br0"
2017-11-23 02:30:10 +00:00
- name: Stopping services
include_tasks: down-debian.yml
2017-11-22 19:10:53 +00:00
- name: Reload systemd
shell: systemctl daemon-reload
2017-05-27 18:09:50 +00:00
# now pick up denyinterfaces
2017-11-08 07:00:07 +00:00
- name: Restart dhcpcd
2017-11-22 19:10:53 +00:00
service:
name: dhcpcd
state: restarted
2017-12-29 06:08:01 +00:00
- name: Restart the networking service if appropriate
2017-11-22 19:10:53 +00:00
service:
name: networking
enabled: yes
state: restarted
2017-11-23 07:28:36 +00:00
when: not nobridge is defined and not no_net_restart
2017-11-22 19:10:53 +00:00
2017-12-29 06:08:01 +00:00
- name: Restart hostapd if appropriate
2017-11-22 19:10:53 +00:00
service:
name: hostapd
state: restarted
2018-03-30 00:17:56 +00:00
when: hostapd_enabled and iiab_wan_iface != discovered_wireless_iface and iiab_network_mode != "Appliance"
- name: Ansible is having a problem enabling services
shell: systemctl enable hostapd
2018-03-30 00:17:56 +00:00
when: hostapd_enabled and iiab_wan_iface != discovered_wireless_iface and iiab_network_mode != "Appliance"
2017-11-22 19:10:53 +00:00
#- name: dhcp_server may be affected - starting - user choice
# service: name={{ dhcp_service2 }} state=started
# when: iiab_network_mode != "Appliance"