Files
dsfin-ansible/roles/wifi/tasks/main.yaml
mpelle426 ed7eabd399 -numerous changes to work with Raspbian 10
-redo of some roles, particularly GUI
-modifications to support working from a "Raspbian Lite" install
2019-07-10 14:24:34 +01:00

109 lines
2.6 KiB
YAML

---
- name: Remove wpasupplicant package
become: yes
apt:
name: ['wpasupplicant']
state: absent
purge: true
tags: wireless_ap
- name: configure wlan0
become: true
blockinfile:
path: /etc/dhcpcd.conf
block: |
interface wlan0
static ip_address=10.250.250.1/29
nohook wpa_supplicant
tags: wireless_ap
- name: install hostapd
become: true
apt:
name: ['hostapd']
state: present
tags: wireless_ap
- name: configure hostapd
become: true
template:
src: "{{ role_path }}/templates/hostapd.conf.j2"
dest: "/etc/hostapd/hostapd.conf"
owner: root
group: root
backup: yes
tags: wireless_ap
- name: configure hostapd startup
become: true
tags: wireless_ap
lineinfile:
state: present
path: "{{ item.path }}"
regexp: "{{ item.regexp }}"
line: "{{ item.line }}"
with_items:
- { path: "/etc/init.d/hostapd", regexp: "^DAEMON_CONF=", line: "DAEMON_CONF=/etc/hostapd/hostapd.conf" }
- { path: "/etc/default/hostapd", regexp: "^#DAEMON_CONF=", line: "DAEMON_CONF=\"/etc/hostapd/hostapd.conf\"" }
- name: enable hostapd
become: true
systemd:
name: hostapd
enabled: yes
masked: no
state: restarted
tags: wireless_ap
- name: install dnsmasq
become: true
apt:
name: ['dnsmasq']
state: present
tags: wireless_ap
- name: configure dnsmasq
become: true
copy:
src: "{{ role_path }}/files/dnsmasq.conf"
dest: "/etc/dnsmasq.conf"
backup: yes
owner: root
group: root
tags: wireless_ap
- name: enable dnsmasq
become: true
systemd:
name: dnsmasq
enabled: yes
masked: no
state: restarted
tags: wireless_ap
- name: enable ipv4.forwarding
become: true
sysctl:
name: net.ipv4.ip_forward
value: 1
sysctl_set: yes
state: present
reload: yes
tags: wireless_ap
- name: copy fw config
become: true
copy:
src: "{{ role_path }}/files/iptables.ipv4.nat"
dest: "/etc/iptables.ipv4.nat"
backup: yes
owner: root
group: root
tags: wireless_ap
- name: iptables-restore to rc.local
lineinfile:
path: "/etc/rc.local"
state: present
insertbefore: "exit 0"
line: "iptables-restore < /etc/iptables.ipv4.nat"
become: true
tags: wireless_ap
- name: restart dhcpcd
become: true
systemd:
name: dhcpcd
enabled: yes
masked: no
state: restarted
tags: wireless_ap