Working sound setup for raspis
This commit is contained in:
10
roles/pi-standard-setup/files/wifi-watchdog.sh
Normal file
10
roles/pi-standard-setup/files/wifi-watchdog.sh
Normal file
@@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
if /sbin/ifconfig wlan0 | /bin/grep -q "inet addr:" ; then
|
||||
logger "Tested Inet connection - everything ok"
|
||||
echo "Tested Inet connection - everything ok"
|
||||
else
|
||||
logger "Network connection down! Attempting reconnection."
|
||||
echo "Network connection down! Attempting reconnection."
|
||||
/sbin/ifup --force wlan0
|
||||
fi
|
||||
@@ -1,3 +1,4 @@
|
||||
---
|
||||
- name: restart sshd
|
||||
service:
|
||||
name: sshd
|
||||
|
||||
@@ -27,14 +27,13 @@
|
||||
command: "raspi-config nonint get_hostname"
|
||||
register: pi_hostname
|
||||
changed_when: False
|
||||
- name: Change hostname to {{ new_hostname }}
|
||||
- name: Change hostname {{ new_hostname }}
|
||||
command: "raspi-config nonint do_hostname {{ new_hostname }}"
|
||||
when: new_hostname | bool and pi_hostname.stdout != new_hostname
|
||||
register: set_hostname
|
||||
notify: reboot
|
||||
- name: Get hostname
|
||||
command: "raspi-config nonint get_hostname"
|
||||
when: set_hostname.changed
|
||||
register: pi_hostname
|
||||
changed_when: False
|
||||
- name: set boot mode to CLI
|
||||
@@ -71,15 +70,25 @@
|
||||
ignore_errors: yes #to avoid error when WiFi is not present
|
||||
- name: Change WiFi country
|
||||
command: "raspi-config nonint do_wifi_country {{ wifi_country }}"
|
||||
when: wifi_ssid | bool
|
||||
- name: Set WiFi credentials
|
||||
command: "raspi-config nonint do_wifi_ssid_passphrase {{ wifi_ssid }} {{ lookup('keepass', wifi_pass_url) }}"
|
||||
command: "raspi-config nonint do_wifi_ssid_passphrase {{ wifi_ssid }} {{ lookup('keepass', bauer_wifi) }}"
|
||||
when: wifi_ssid | bool
|
||||
- name: Copy WIFI watchdog script
|
||||
copy: src=wifi-watchdog.sh dest=/usr/sbin/wifi-watchdog.sh
|
||||
when: wifi_ssid | bool
|
||||
- name: Run WIFI watchdog script periodically
|
||||
cron:
|
||||
name: "WIFI Watchdog"
|
||||
minute: "*/15"
|
||||
job: /usr/sbin/wifi-watchdog.sh
|
||||
when: wifi_ssid | bool
|
||||
# Message of the day
|
||||
- name: Set Message of the day
|
||||
copy: src=motd/{{ pi_hostname.stdout }} dest=/etc/motd
|
||||
# LED off script
|
||||
- name: Copy led off script
|
||||
copy: src=configs/raspi-leds-off.sh dest=/usr/sbin/raspi-leds-off.sh mode="u+rwx"
|
||||
copy: src=raspi-leds-off.sh dest=/usr/sbin/raspi-leds-off.sh mode="u+rwx"
|
||||
- name: Copy led off service
|
||||
copy: src=raspi-leds-off.service dest=/lib/systemd/system/
|
||||
- name: Activate led off servic
|
||||
|
||||
Reference in New Issue
Block a user