Added sysdweb
This commit is contained in:
13
roles/pi-standard-setup/defaults/main.yml
Normal file
13
roles/pi-standard-setup/defaults/main.yml
Normal file
@@ -0,0 +1,13 @@
|
||||
---
|
||||
wifi_ssid: "" # put SSID here to configure wifi
|
||||
ansible_user: "root" # "User to connect with, put in 'pi' here if you connect the first time, else leave empty"
|
||||
new_hostname: "" # set this to change the hostname
|
||||
|
||||
|
||||
timezone: "Europe/Berlin"
|
||||
wifi_country: "DE"
|
||||
wifi_pass_url: "bauer_wifi" # has to be in keepass with url "wifi_pass_url"
|
||||
ansible_ssh_pass: "raspberry"
|
||||
ansible_become_password: "raspberry"
|
||||
ansible_become: yes
|
||||
|
||||
7
roles/pi-standard-setup/files/gitconfig
Normal file
7
roles/pi-standard-setup/files/gitconfig
Normal file
@@ -0,0 +1,7 @@
|
||||
[user]
|
||||
name = Martin Bauer
|
||||
email = bauer_martin@gmx.de
|
||||
[alias]
|
||||
sf = submodule foreach
|
||||
[core]
|
||||
autocrlf = input
|
||||
14
roles/pi-standard-setup/files/motd/bedroompi
Normal file
14
roles/pi-standard-setup/files/motd/bedroompi
Normal file
@@ -0,0 +1,14 @@
|
||||
|
||||
WELCOME IN THE BEDROOM
|
||||
|
||||
!__________!
|
||||
|____ ____|
|
||||
_____ {____}{____} _____
|
||||
__|_*_|__%%%%%%%%%%%%__|_*_|
|
||||
| | %%%%%%%%%%%%%% | |
|
||||
%%%%%%%%%%%%%%%%
|
||||
%%%%%%%%%%%%%%%%%%
|
||||
%%%%%%%%%%%%%%%%%%%%
|
||||
/||||||||||||||||||||\
|
||||
||||||||||||||||||||||
|
||||
|
||||
18
roles/pi-standard-setup/files/motd/kitchenpi
Normal file
18
roles/pi-standard-setup/files/motd/kitchenpi
Normal file
@@ -0,0 +1,18 @@
|
||||
|
||||
WELCOME IN THE KITCHEN
|
||||
|
||||
___
|
||||
.' _ '.
|
||||
/ /` `\ \
|
||||
| | [__]
|
||||
| | {{
|
||||
| | }}
|
||||
_ | | _ {{
|
||||
___________<_>_| |_<_>}}________
|
||||
.=======^=(___)=^={{====.
|
||||
/ .----------------}}---. \
|
||||
/ / {{ \ \
|
||||
/ / }} \ \
|
||||
( '=========================' )
|
||||
'-----------------------------'
|
||||
|
||||
4
roles/pi-standard-setup/files/motd/newrpi
Normal file
4
roles/pi-standard-setup/files/motd/newrpi
Normal file
@@ -0,0 +1,4 @@
|
||||
|
||||
THIS IS A NEW RASPI - CONFIGURE IT!
|
||||
|
||||
|
||||
8
roles/pi-standard-setup/files/raspi-leds-off.service
Normal file
8
roles/pi-standard-setup/files/raspi-leds-off.service
Normal file
@@ -0,0 +1,8 @@
|
||||
[Unit]
|
||||
Description=Turn Raspi LEDs off at boot
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/sbin/raspi-leds-off.sh
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
7
roles/pi-standard-setup/files/raspi-leds-off.sh
Normal file
7
roles/pi-standard-setup/files/raspi-leds-off.sh
Normal file
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo none > /sys/class/leds/led0/trigger
|
||||
echo none > /sys/class/leds/led1/trigger
|
||||
|
||||
echo 0 >/sys/class/leds/led0/brightness
|
||||
echo 0 >/sys/class/leds/led1/brightness
|
||||
2
roles/pi-standard-setup/files/sshkey.pub
Normal file
2
roles/pi-standard-setup/files/sshkey.pub
Normal file
@@ -0,0 +1,2 @@
|
||||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCu66CgHoF+v1z5ydpu0SJzPuAa0eARLLggMAJY4vWcLfLTTlFjwPpO9kjkr4acUL5uLHZkAFqXQZC91io80bIfyBiM1i1yBq290x8sETgoNHrNzvcCQUBAeCxhcogi68F14BbpwBbejDTPKKybpuuAnVPj9YiHVFEDbqjLwoEY+HH7SkCsrK8qTyp9rHzwPGk0xPBwTnCPXqzvUCr/4H+m/5lamVIOW6XYoqnvAp5jP0mbadrmB0PwvK8cfgwPJWQeLJcqwl87mwHjjlrCinkpQbd2D8mR798bGmW/iTZ7GLCkyBNE34qKg24CzE0scWjqyWICXOrTYUXLORDt99/F martin@Laptop
|
||||
|
||||
14
roles/pi-standard-setup/files/vimrc
Normal file
14
roles/pi-standard-setup/files/vimrc
Normal file
@@ -0,0 +1,14 @@
|
||||
:colorscheme elflord
|
||||
:set tabstop=4
|
||||
:set shiftwidth=4
|
||||
:set expandtab
|
||||
|
||||
"other key mappings
|
||||
inoremap jk <Esc>
|
||||
|
||||
|
||||
syntax on
|
||||
|
||||
" Treat long lines as break lines (useful when moving around in them)
|
||||
map j gj
|
||||
map k gk
|
||||
7
roles/pi-standard-setup/handlers/main.yml
Normal file
7
roles/pi-standard-setup/handlers/main.yml
Normal file
@@ -0,0 +1,7 @@
|
||||
- name: restart sshd
|
||||
service:
|
||||
name: sshd
|
||||
state: restarted
|
||||
- name: reboot
|
||||
reboot:
|
||||
|
||||
86
roles/pi-standard-setup/tasks/main.yml
Normal file
86
roles/pi-standard-setup/tasks/main.yml
Normal file
@@ -0,0 +1,86 @@
|
||||
---
|
||||
- name: Do apt update/upgrade
|
||||
apt: upgrade=yes update_cache=yes cache_valid_time=7200
|
||||
- name: Detect Raspi Model
|
||||
slurp: src=/sys/firmware/devicetree/base/model
|
||||
register: raspberry_model
|
||||
- name: Show Raspi Model
|
||||
debug: msg={{ raspberry_model.content | b64decode }}
|
||||
- name: Add authorized SSH key to root account
|
||||
authorized_key:
|
||||
user: root
|
||||
key: "{{ lookup('file', 'sshkey.pub') }}"
|
||||
state: present
|
||||
- name: Activate root login with key
|
||||
lineinfile:
|
||||
path: /etc/ssh/sshd_config
|
||||
regexp: "^#?PermitRootLogin"
|
||||
line: "PermitRootLogin prohibit-password"
|
||||
notify: restart sshd
|
||||
- name: Deactive SSH accepting locale vars (leads to warnings)
|
||||
lineinfile:
|
||||
path: /etc/ssh/sshd_config
|
||||
regexp: "^#?AcceptEnv LANG LC_*"
|
||||
line: "#AcceptEnv LANG LC_*"
|
||||
notify: restart sshd
|
||||
- name: Get hostname
|
||||
command: "raspi-config nonint get_hostname"
|
||||
register: pi_hostname
|
||||
changed_when: False
|
||||
- name: Change hostname to {{ 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
|
||||
command: "raspi-config nonint do_boot_behaviour B1"
|
||||
#I2 Change Timezone
|
||||
- name: Change timezone
|
||||
command: "raspi-config nonint do_change_timezone {{ timezone }}"
|
||||
- name: Change locale
|
||||
command: "raspi-config nonint do_change_locale en_US.UTF-8"
|
||||
- name: Change password of default pi account
|
||||
user:
|
||||
name: pi
|
||||
update_password: always
|
||||
password: "{{ lookup('keepass', 'default_rpi_password') | password_hash('sha512') }}"
|
||||
- name: Install Packages (vim, git, basic python stuff)
|
||||
apt:
|
||||
name:
|
||||
- vim
|
||||
- git
|
||||
- python3
|
||||
- python3-pip
|
||||
- python3-wheel
|
||||
cache_valid_time: 7200
|
||||
state: present
|
||||
- name: Copy vim config
|
||||
copy: src=vimrc dest=/root/.vimrc
|
||||
- name: Copy git config
|
||||
copy: src=gitconfig dest=/root/.gitconfig
|
||||
# Wifi
|
||||
- name: Get WiFi country
|
||||
command: "raspi-config nonint get_wifi_country"
|
||||
register: wifi_country
|
||||
changed_when: False
|
||||
ignore_errors: yes #to avoid error when WiFi is not present
|
||||
- name: Change WiFi country
|
||||
command: "raspi-config nonint do_wifi_country {{ wifi_country }}"
|
||||
- name: Set WiFi credentials
|
||||
command: "raspi-config nonint do_wifi_ssid_passphrase {{ wifi_ssid }} {{ lookup('keepass', wifi_pass_url) }}"
|
||||
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"
|
||||
- name: Copy led off service
|
||||
copy: src=raspi-leds-off.service dest=/lib/systemd/system/
|
||||
- name: Activate led off servic
|
||||
systemd: name=raspi-leds-off state=restarted enabled=yes daemon_reload=yes
|
||||
Reference in New Issue
Block a user