-fixup wifi items

-TPD: parameterize wifi setup, task dependencies
This commit is contained in:
Pi
2019-03-20 13:46:34 -04:00
parent 059052675e
commit 24ff82fa74

View File

@@ -7,12 +7,13 @@
purge: true purge: true
tags: wireless_ap tags: wireless_ap
- name: configure wlan0 - name: configure wlan0
become: true
blockinfile: blockinfile:
path: /etc/dhcpcd.conf path: /etc/dhcpcd.conf
block: | block: |
interface wlan0 interface wlan0
static ip_address=10.250.250.1/29 static ip_address=10.250.250.1/29
nohook wpa_supplicant nohook wpa_supplicant
tags: wireless_ap tags: wireless_ap
- name: install hostapd - name: install hostapd
become: true become: true
@@ -24,11 +25,22 @@
become: true become: true
template: template:
src: "{{ role_path }}/templates/hostapd.conf.j2" src: "{{ role_path }}/templates/hostapd.conf.j2"
dest: "/etc/hostapd/hostapd.conf dest: "/etc/hostapd/hostapd.conf"
owner: root owner: root
group: root group: root
backup: yes backup: yes
tags: wireless_ap 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 - name: enable hostapd
become: true become: true
systemd: systemd:
@@ -55,19 +67,19 @@
- name: enable dnsmasq - name: enable dnsmasq
become: true become: true
systemd: systemd:
name: dnsmasq name: dnsmasq
enabled: yes enabled: yes
masked: no masked: no
state: restarted state: restarted
tags: wireless_ap tags: wireless_ap
- name: enable ipv4.forwarding - name: enable ipv4.forwarding
lineinfile:
path: "/etc/sysctl.conf"
state: present
regexp: '^#net\.ipv4\.ip_forward=1'
line: 'net.ipv4.ip_forward=1'
validate: 'sysctl -p'
become: true become: true
sysctl:
name: net.ipv4.ip_forward
value: 1
sysctl_set: yes
state: present
reload: yes
tags: wireless_ap tags: wireless_ap
- name: copy fw config - name: copy fw config
become: true become: true
@@ -93,4 +105,4 @@
enabled: yes enabled: yes
masked: no masked: no
state: restarted state: restarted
tags: wireless_ap tags: wireless_ap