Browse Source

updatepis mit subtasks.

master
Olli Graf 1 year ago
parent
commit
eb2c0d086d
  1. 3
      ansible.cfg
  2. 9
      bin/measure_temp.sh
  3. 4
      bin/run-stressberry.sh
  4. 35
      hosts
  5. 2
      initpi.yml
  6. 3
      roles/installpkg/tasks/main.yml
  7. 2
      roles/log2ram/tasks/main.yml
  8. 2
      roles/mounttank/tasks/main.yml
  9. 31
      roles/stresspi/tasks/main.yml
  10. 6
      roles/subtasks/reboot.yml
  11. 9
      roles/subtasks/upgrade.yml
  12. 15
      roles/updatepi/tasks/main.yml
  13. 15
      roles/updateservers/tasks/main.yml
  14. 1
      updatepis.yml
  15. 1
      updateservers.yml

3
ansible.cfg

@ -4,7 +4,8 @@ interpreter_python = auto_silent
nocows = 1
timeout= 60
force_valid_group_names = ignore
private_key_file = ~/.ssh/id_rsa
private_key_file = ~/.ssh/id_ed25519
#private_key_file = ~/.ssh/id_rsa
[ssh_connection]
ssh_args = -o StrictHostKeyChecking=no

9
bin/measure_temp.sh

@ -0,0 +1,9 @@
#! /bin/bash
for f in {1..10}
do
vcgencmd measure_temp
sysbench cpu --cpu-max-prime=50000 --threads=4 --time=120 run > /dev/null 2>&1
done
vcgencmd measure_temp

4
bin/run-stressberry.sh

@ -3,6 +3,6 @@
mkdir -p /tank/stressberry/${HOSTNAME}
cd /tank/stressberry/${HOSTNAME}
/usr/local/bin/stressberry-run -n "${HOSTNAME}" -d 1800 -i 300 -c 4 ${HOSTNAME}.out
/usr/local/bin/stressberry-plot ${HOSTNAME}.out -f -d 300 -f -l 400 2200 -t 25 90 -o ${HOSTNAME}.png --not-transparent
~/.local/bin/stressberry-run -n "${HOSTNAME}" -d 1800 -i 300 -c 4 ${HOSTNAME}.out
~/.local/bin/stressberry-plot ${HOSTNAME}.out -f -d 300 -f -l 400 3100 -t 25 90 -o ${HOSTNAME}.png --not-transparent

35
hosts

@ -7,6 +7,12 @@ pi-tanked:
hans:
cleatus:
clancy:
database:
zero2w:
hosts:
steve:
ziff:
bramble4:
hosts:
@ -14,6 +20,23 @@ bramble4:
willie:
kirk:
brandine:
vars:
ansible_python_interpreter: /usr/bin/python3
ansible_connection: ssh
ansible_sudo: true
ansible_become: true
ansible_user: pi
ansible_ssh_common_args: '-o StrictHostKeyChecking=no'
ansible_ssh_private_key_file: ~/.ssh/id_rsa
# ansible_ssh_private_key_file: ~/.ssh/id_ed25519
rock5b:
hosts:
stu:
pi5:
hosts:
uter:
kodos:
pi4:
hosts:
@ -30,9 +53,10 @@ pi4:
kirk:
brandine:
martin:
lenny:
terry:
skinner:
database:
raspberrypi:
pis:
hosts:
@ -47,13 +71,13 @@ pis:
mary:
sherry:
carl:
database:
barney:
kirk:
brandine:
edna:
arnie:
bart:
lenny:
apu:
vars:
ansible_python_interpreter: /usr/bin/python3
@ -63,6 +87,7 @@ pis:
ansible_user: pi
ansible_ssh_common_args: '-o StrictHostKeyChecking=no'
ansible_ssh_private_key_file: ~/.ssh/id_rsa
# ansible_ssh_private_key_file: ~/.ssh/id_ed25519
blini:
hosts:
quimby:
@ -95,17 +120,11 @@ frinks:
ansible_ssh_private_key_file: ~/.ssh/id_rsa
servers:
hosts:
# ollital.nrw:
# vasmani.de:
# ollital.net:
ashkente.de:
# 85.214.129.239:
mail.olli-cloud.de:
git.olli-cloud.de:
mumble.olli-cloud.de:
blog.olli-cloud.de:
mehrnext.de:
# h2951071.stratoserver.net:
vars:
ansible_python_interpreter: /usr/bin/python3
ansible_connection: ssh

2
initpi.yml

@ -5,7 +5,7 @@
roles:
- initpi
- installpkg
- mountbackup
- mounttank
- installsoft
- log2ram
- disableswap

3
roles/installpkg/tasks/main.yml

@ -8,6 +8,7 @@
apt:
name:
- neofetch
# - nala
- cowsay
- docker.io
- git
@ -19,7 +20,7 @@
- lsof
- ripgrep
- atop
- btop
# - btop
- htop
- pip
- sysbench

2
roles/log2ram/tasks/main.yml

@ -11,7 +11,7 @@
- name: Paketquelle
become: true
apt_repository:
repo: 'deb http://packages.azlux.fr/debian/ buster main'
repo: 'deb http://packages.azlux.fr/debian/ bookworm main'
state: present
filename: log2ram
update_cache: yes

2
roles/mounttank/tasks/main.yml

@ -4,3 +4,5 @@
ansible.posix.mount:
path: /tank
state: mounted
fstype: nfs
src: 192.168.178.36:/mnt/md0/public

31
roles/stresspi/tasks/main.yml

@ -1,26 +1,27 @@
- name: PI Update
become: true
apt:
update_cache: yes
upgrade: dist
- name: Stress installieren (apt)
- name: create venv dir
file:
path: ~/venv
state: directory
- name: virtualenv installieren
become: true
apt:
name:
- stress
- libjpeg-dev
- zlib1g-dev
- libatlas-base-dev
- cmake
- python3-numpy
- python3-virtualenv
- name: virtuelle Umgebung anlegen
command:
cmd: virtualenv ~/venv/stressberry
creates: "~/venv/stressberry"
#- name: aktiviere virtuelle Umgebung
# shell: source ~/venv/stressberry/bin/activate
- name : Stress installieren(pip)
- name: Stressberry installieren
ansible.builtin.pip:
name:
- stressberry
# - numpy
- numpy
extra_args: --break-system-packages
- name: copy script
@ -37,5 +38,3 @@
become_user: pi
command: ~/bin/run-stressberry.sh

6
roles/subtasks/reboot.yml

@ -0,0 +1,6 @@
---
- name: Neustart if /var/run/reboot-reqired exists
command: shutdown -r now
args:
removes: /var/run/reboot-required

9
roles/subtasks/upgrade.yml

@ -0,0 +1,9 @@
---
- name: APT upgrade
become: true
apt:
upgrade: dist
update_cache: yes
cache_valid_time: 86400
autoremove: yes

15
roles/updatepi/tasks/main.yml

@ -11,16 +11,5 @@
regexp: buster
replace: bookworm
when: stat_result.stat.exists
- name: PIs aktualisieren
become: true
apt:
upgrade: dist
update_cache: yes
cache_valid_time: 120
autoremove: yes
- name: Pi Neustart if /var/run/reboot-reqired exists
command: shutdown -r now
args:
removes: /var/run/reboot-required
- include_tasks: ../subtasks/upgrade.yml
- include_tasks: ../subtasks/reboot.yml

15
roles/updateservers/tasks/main.yml

@ -1,13 +1,2 @@
- name: Servers aktualisieren
become: true
apt:
upgrade: dist
update_cache: yes
cache_valid_time: 86400
autoremove: yes
- name: Server Neustart if /var/run/reboot-reqired exists
command: shutdown -r now
args:
removes: /var/run/reboot-required
- include: ../subtasks/upgrade.yml
- include: ../subtasks/reboot.yml

1
updatepis.yml

@ -4,4 +4,5 @@
remote_user: pi
roles:
- updatepi
# - update-sshkey

1
updateservers.yml

@ -4,4 +4,5 @@
remote_user: olli
roles:
- updateservers
# - update-sshkey

Loading…
Cancel
Save