-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpi-pineapple.yaml
56 lines (48 loc) · 1.99 KB
/
pi-pineapple.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
- hosts: RASPI_WIFI
remote_user: pi
become: yes
become_method: sudo
become_user: root
vars:
domain_name: cthulhuuuu.iot
wlan_interface: wlan0
ssid_name: Pi-Pineapple
wpa_passphrase: pineapple
tasks:
- name: ensure hostapd is at the latest version
apt: name=hostapd state=latest
- name: ensure dns & dhcp server is at the latest version
apt: name=dnsmasq state=latest
- name: ensure haveged (entropy generator) is at the latest version
apt: name=haveged state=latest
- name: ensure iptables-persistent is at the latest version
apt: name=iptables-persistent state=latest
- name: copy dhcpcd configuration file
template: src=dhcpcd.j2 dest=/etc/dhcpcd.conf
- name: restart Wlan interfaces
command: bash -c "ifconfig {{ wlan_interface }} down && ifconfig {{ wlan_interface }} up"
- name: copy hostapd psk file (for WPS)
template: src=hostapd.psk dest=/etc/hostapd.psk
- name: copy hostapd configuration file
template: src=hostapd.j2 dest=/etc/hostapd/hostapd.conf
- name: copy hostapd default configuration file
template: src=hostapd.conf dest=/etc/default/hostapd.conf
- name: copy dnsmasq configuration file
template: src=dnsmasq.j2 dest=/etc/dnsmasq.conf
- name: ensure hostapd is running and enable at boot
service: name=hostapd state=restarted enabled=yes
- name: ensure dnsmasq is running and enable at boot
service: name=dnsmasq state=restarted enabled=yes
- name: copy iptables configuration
template: src=rules.v4.j2 dest=/etc/iptables/rules.v4
- name: restore iptables
command: iptables-restore /etc/iptables/rules.v4
- name: ensure iptables-persistent (netfilter-persistent) is running and enable at boot
service: name=netfilter-persistent state=started enabled=yes
- name: ensure ip forwarding is enabled
sysctl:
name: net.ipv4.ip_forward
value: "1"
sysctl_set: yes
state: present
reload: yes