mirror of
https://github.com/jayofelony/pwnagotchi.git
synced 2025-07-01 18:37:27 -04:00
Merge pull request #153 from dadav/fix/ansible
Refracture ansible playbook
This commit is contained in:
@ -3,68 +3,55 @@
|
|||||||
- 127.0.0.1
|
- 127.0.0.1
|
||||||
become: yes
|
become: yes
|
||||||
vars:
|
vars:
|
||||||
pwn_hostname: "{{ lookup('env', 'PWN_HOSTNAME') | default('pwnagotchi', true) }}"
|
pwnagotchi:
|
||||||
pwn_version: "{{ lookup('env', 'PWN_VERSION') | default('master', true) }} "
|
hostname: "{{ lookup('env', 'PWN_HOSTNAME') | default('pwnagotchi', true) }}"
|
||||||
bettercap_query: "assets[?contains(name, 'armv6l')].browser_download_url"
|
version: "{{ lookup('env', 'PWN_VERSION') | default('master', true) }} "
|
||||||
|
system:
|
||||||
tasks:
|
boot_options:
|
||||||
|
- "dtoverlay=dwc2"
|
||||||
- name: selected hostname
|
- "dtparam=spi=on"
|
||||||
debug:
|
- "dtoverlay=spi1-3cs"
|
||||||
msg: "{{ pwn_hostname }}"
|
- "dtoverlay=pi3-disable-bt"
|
||||||
|
- "dtparam=audio=off"
|
||||||
- name: build version
|
services:
|
||||||
debug:
|
enable:
|
||||||
msg: "{{ pwn_version }}"
|
- dphys-swapfile.service
|
||||||
|
- getty@ttyGS0.service
|
||||||
- name: change hostname
|
disable:
|
||||||
hostname:
|
- apt-daily.timer
|
||||||
name: "{{pwn_hostname}}"
|
- apt-daily.service
|
||||||
|
- apt-daily-upgrade.timer
|
||||||
- name: add hostname to /etc/hosts
|
- apt-daily-upgrade.service
|
||||||
lineinfile:
|
- wpa_supplicant.service
|
||||||
dest: /etc/hosts
|
- bluetooth.service
|
||||||
regexp: '^127\.0\.0\.1[ \t]+localhost'
|
- triggerhappy.service
|
||||||
line: '127.0.0.1 localhost {{pwn_hostname}} {{pwn_hostname}}.local'
|
- ifup@wlan0.service
|
||||||
state: present
|
|
||||||
|
|
||||||
- name: Add re4son-kernel repo key
|
|
||||||
apt_key:
|
|
||||||
url: https://re4son-kernel.com/keys/http/archive-key.asc
|
|
||||||
state: present
|
|
||||||
|
|
||||||
- name: Add re4son-kernel repository
|
|
||||||
apt_repository:
|
|
||||||
repo: deb http://http.re4son-kernel.com/re4son/ kali-pi main
|
|
||||||
state: present
|
|
||||||
|
|
||||||
- name: update apt package cache
|
|
||||||
apt:
|
|
||||||
update_cache: yes
|
|
||||||
|
|
||||||
- name: remove unecessary apt packages
|
|
||||||
apt:
|
|
||||||
name: "{{ packages }}"
|
|
||||||
state: absent
|
|
||||||
purge: yes
|
|
||||||
vars:
|
|
||||||
packages:
|
packages:
|
||||||
|
pip:
|
||||||
|
install:
|
||||||
|
- inky
|
||||||
|
- smbus2
|
||||||
|
- absl-py>=0.1.6
|
||||||
|
- enum34
|
||||||
|
- gast==0.2.2
|
||||||
|
- google_pasta
|
||||||
|
- opt_einsum
|
||||||
|
- scapy
|
||||||
|
- gym
|
||||||
|
- keras_applications>=1.0.6
|
||||||
|
- keras_preprocessing>=1.0.5
|
||||||
|
- stable-baselines
|
||||||
|
- file_read_backwards
|
||||||
|
- tensorflow_estimator>=1.14.0,<1.15.0
|
||||||
|
- tensorboard>=1.13.0,<1.14.0
|
||||||
|
apt:
|
||||||
|
remove:
|
||||||
- rasberrypi-net-mods
|
- rasberrypi-net-mods
|
||||||
- dhcpcd5
|
- dhcpcd5
|
||||||
- triggerhappy
|
- triggerhappy
|
||||||
- wpa_supplicant
|
- wpa_supplicant
|
||||||
- nfs-common
|
- nfs-common
|
||||||
|
install:
|
||||||
- name: upgrade apt distro
|
|
||||||
apt:
|
|
||||||
upgrade: dist
|
|
||||||
|
|
||||||
- name: install packages
|
|
||||||
apt:
|
|
||||||
name: "{{ packages }}"
|
|
||||||
state: present
|
|
||||||
vars:
|
|
||||||
packages:
|
|
||||||
- vim
|
- vim
|
||||||
- screen
|
- screen
|
||||||
- golang
|
- golang
|
||||||
@ -123,64 +110,72 @@
|
|||||||
- python3-scipy
|
- python3-scipy
|
||||||
- python3-cloudpickle
|
- python3-cloudpickle
|
||||||
|
|
||||||
|
bettercap:
|
||||||
|
query: "assets[?contains(name, 'armv6l')].browser_download_url"
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
|
||||||
|
- name: selected hostname
|
||||||
|
debug:
|
||||||
|
msg: "{{ pwnagotchi.hostname }}"
|
||||||
|
|
||||||
|
- name: build version
|
||||||
|
debug:
|
||||||
|
msg: "{{ pwnagotchi.version }}"
|
||||||
|
|
||||||
|
- name: change hostname
|
||||||
|
hostname:
|
||||||
|
name: "{{pwnagotchi.hostname}}"
|
||||||
|
|
||||||
|
- name: add hostname to /etc/hosts
|
||||||
|
lineinfile:
|
||||||
|
dest: /etc/hosts
|
||||||
|
regexp: '^127\.0\.0\.1[ \t]+localhost'
|
||||||
|
line: '127.0.0.1 localhost {{pwnagotchi.hostname}} {{pwnagotchi.hostname}}.local'
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: Add re4son-kernel repo key
|
||||||
|
apt_key:
|
||||||
|
url: https://re4son-kernel.com/keys/http/archive-key.asc
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: Add re4son-kernel repository
|
||||||
|
apt_repository:
|
||||||
|
repo: deb http://http.re4son-kernel.com/re4son/ kali-pi main
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: update apt package cache
|
||||||
|
apt:
|
||||||
|
update_cache: yes
|
||||||
|
|
||||||
|
- name: remove unecessary apt packages
|
||||||
|
apt:
|
||||||
|
name: "{{ packages.apt.remove }}"
|
||||||
|
state: absent
|
||||||
|
purge: yes
|
||||||
|
|
||||||
|
- name: upgrade apt distro
|
||||||
|
apt:
|
||||||
|
upgrade: dist
|
||||||
|
|
||||||
|
- name: install packages
|
||||||
|
apt:
|
||||||
|
name: "{{ packages.apt.install }}"
|
||||||
|
state: present
|
||||||
|
|
||||||
- name: configure dphys-swapfile
|
- name: configure dphys-swapfile
|
||||||
file:
|
file:
|
||||||
path: /etc/dphys-swapfile
|
path: /etc/dphys-swapfile
|
||||||
content: "CONF_SWAPSIZE=1024"
|
content: "CONF_SWAPSIZE=1024"
|
||||||
|
|
||||||
- name: disable unecessary services
|
|
||||||
systemd:
|
|
||||||
name: "{{services}}"
|
|
||||||
state: stopped
|
|
||||||
enabled: no
|
|
||||||
vars:
|
|
||||||
services:
|
|
||||||
- apt-daily.timer
|
|
||||||
- apt-daily.service
|
|
||||||
- apt-daily-upgrade.timer
|
|
||||||
- apt-daily-upgrade.service
|
|
||||||
- wpa_supplicant.service
|
|
||||||
- bluetooth.service
|
|
||||||
- triggerhappy.service
|
|
||||||
- ifup@wlan0.service
|
|
||||||
|
|
||||||
- name: enable dphys-swapfile service
|
|
||||||
systemd:
|
|
||||||
name: dphys-swapfile.service
|
|
||||||
state: started
|
|
||||||
enabled: yes
|
|
||||||
|
|
||||||
- name: enable gadget serial port service
|
|
||||||
systemd:
|
|
||||||
name: getty@ttyGS0.service
|
|
||||||
state: started
|
|
||||||
enabled: yes
|
|
||||||
|
|
||||||
- name: acquire python3 pip target
|
- name: acquire python3 pip target
|
||||||
command: "python3 -c 'import sys;print(sys.path.pop())'"
|
command: "python3 -c 'import sys;print(sys.path.pop())'"
|
||||||
register: pip_target
|
register: pip_target
|
||||||
|
|
||||||
- name: install pip packages
|
- name: install pip packages
|
||||||
pip:
|
pip:
|
||||||
name: "{{ packages }}"
|
name: "{{packages.pip.install}}"
|
||||||
extra_args: "--no-deps --extra-index-url=https://www.piwheels.hostedpi.com/simple/ --prefer-binary --no-cache-dir --platform=armv6l --target={{ pip_target.stdout }}"
|
extra_args: "--no-deps --extra-index-url=https://www.piwheels.hostedpi.com/simple/ --prefer-binary --no-cache-dir --platform=armv6l --target={{ pip_target.stdout }}"
|
||||||
vars:
|
|
||||||
packages:
|
|
||||||
- inky
|
|
||||||
- smbus2
|
|
||||||
- absl-py>=0.1.6
|
|
||||||
- enum34
|
|
||||||
- gast==0.2.2
|
|
||||||
- google_pasta
|
|
||||||
- opt_einsum
|
|
||||||
- scapy
|
|
||||||
- gym
|
|
||||||
- keras_applications>=1.0.6
|
|
||||||
- keras_preprocessing>=1.0.5
|
|
||||||
- stable-baselines
|
|
||||||
- file_read_backwards
|
|
||||||
- tensorflow_estimator>=1.14.0,<1.15.0
|
|
||||||
- tensorboard>=1.13.0,<1.14.0
|
|
||||||
|
|
||||||
- name: install grpcio
|
- name: install grpcio
|
||||||
command: "pip3 install --no-deps --extra-index-url=https://www.piwheels.hostedpi.com/simple/ --no-cache-dir --prefer-binary --platform=armv6l --only-binary=:all: --target={{ pip_target.stdout }} https://www.piwheels.hostedpi.com/simple/grpcio/grpcio-1.24.1-cp37-cp37m-linux_armv6l.whl"
|
command: "pip3 install --no-deps --extra-index-url=https://www.piwheels.hostedpi.com/simple/ --no-cache-dir --prefer-binary --platform=armv6l --only-binary=:all: --target={{ pip_target.stdout }} https://www.piwheels.hostedpi.com/simple/grpcio/grpcio-1.24.1-cp37-cp37m-linux_armv6l.whl"
|
||||||
@ -196,7 +191,7 @@
|
|||||||
|
|
||||||
- name: download and install bettercap
|
- name: download and install bettercap
|
||||||
unarchive:
|
unarchive:
|
||||||
src: "{{ bettercap_release.content | from_json | json_query(bettercap_query) | first }}"
|
src: "{{ bettercap_release.content | from_json | json_query(bettercap.query) | first }}"
|
||||||
dest: /usr/bin
|
dest: /usr/bin
|
||||||
remote_src: yes
|
remote_src: yes
|
||||||
exclude:
|
exclude:
|
||||||
@ -324,11 +319,7 @@
|
|||||||
insertafter: EOF
|
insertafter: EOF
|
||||||
line: '{{ item }}'
|
line: '{{ item }}'
|
||||||
with_items:
|
with_items:
|
||||||
- "dtoverlay=dwc2"
|
- "{{system.boot_options}}"
|
||||||
- "dtparam=spi=on"
|
|
||||||
- "dtoverlay=spi1-3cs"
|
|
||||||
- "dtoverlay=pi3-disable-bt"
|
|
||||||
- "dtparam=audio=off"
|
|
||||||
|
|
||||||
- name: change root partition
|
- name: change root partition
|
||||||
replace:
|
replace:
|
||||||
@ -356,7 +347,7 @@
|
|||||||
- name: configure motd
|
- name: configure motd
|
||||||
copy:
|
copy:
|
||||||
dest: /etc/motd
|
dest: /etc/motd
|
||||||
content: "(◕‿‿◕) {{pwn_hostname}} (pwnagotchi-{{pwn_version}})"
|
content: "(◕‿‿◕) {{pwnagotchi.hostname}} (pwnagotchi-{{pwnagotchi.version}})"
|
||||||
|
|
||||||
- name: clean apt cache
|
- name: clean apt cache
|
||||||
apt:
|
apt:
|
||||||
@ -366,16 +357,21 @@
|
|||||||
apt:
|
apt:
|
||||||
autoremove: yes
|
autoremove: yes
|
||||||
|
|
||||||
|
- name: enable services
|
||||||
|
systemd:
|
||||||
|
name: "{{services.enable}}"
|
||||||
|
state: started
|
||||||
|
enabled: yes
|
||||||
|
|
||||||
|
- name: disable unecessary services
|
||||||
|
systemd:
|
||||||
|
name: "{{services.disable}}"
|
||||||
|
state: stopped
|
||||||
|
enabled: no
|
||||||
|
|
||||||
- name: remove ssh keys
|
- name: remove ssh keys
|
||||||
file:
|
file:
|
||||||
state: absent
|
state: absent
|
||||||
path: "{{item}}"
|
path: "{{item}}"
|
||||||
with_items:
|
with_fileglob:
|
||||||
- /etc/ssh/ssh_host_rsa_key
|
- "/etc/ssh/ssh_host*_key*"
|
||||||
- /etc/ssh/ssh_host_rsa_key.pub
|
|
||||||
- /etc/ssh/ssh_host_dsa_key
|
|
||||||
- /etc/ssh/ssh_host_dsa_key.pub
|
|
||||||
- /etc/ssh/ssh_host/ecdsa_key
|
|
||||||
- /etc/ssh/ssh_host/ecdsa_key.pub
|
|
||||||
- /etc/ssh/ssh_host_ed25519_key
|
|
||||||
- /etc/ssh/ssh_host_ed25519_key.pub
|
|
||||||
|
Reference in New Issue
Block a user