Scripte umgezogen

This commit is contained in:
Michael Grote 2021-02-25 09:48:01 +00:00
parent 3d44df1dad
commit 026e32f9d0
11 changed files with 8 additions and 70 deletions

View file

@ -30,27 +30,3 @@
name: "{{ programs_only_physical }}"
state: present
when: ansible_virtualization_role != 'guest'
- name: copy hddtemps.sh
become: yes
ansible.builtin.template:
src: "hddtemps.sh"
dest: "/usr/local/bin/hddtemps.sh"
mode: a+x
when: ansible_virtualization_role != 'guest'
- name: copy systemtemps.sh
become: yes
ansible.builtin.template:
src: "systemtemps.sh"
dest: "/usr/local/bin/systemtemps.sh"
mode: a+x
when: ansible_virtualization_role != 'guest'
- name: copy zfs-free.sh
become: yes
ansible.builtin.template:
mode: 0555
src: zfs-free.sh
dest: /usr/local/bin/zfs-free.sh
when: "'proxmox' in group_names"

View file

@ -1,2 +0,0 @@
#!/bin/bash
watch --interval 10 --differences --color --no-title "sudo hddtemp /dev/disk/by-id/ata-* | grep -v "part" | sed -r 's#(/dev/disk/by-id/ata-)([^:]+).*: ([0-9]{1,3}°C)#\3\t\2#g' | sort -n -r"

View file

@ -1,2 +0,0 @@
#!/bin/bash
watch --interval 10 --differences --color --no-title "sudo ipmitool sensor | cut --delimiter '|' -f 1-3 | grep -i "degrees" | sort -k2 -r | tr --delete \"|\" | tr --squeeze-repeats \" \" | sed -r 's/(degrees C)/°C/g;s/([[:alnum:]]+[[:space:]][[:alpha:]]+ )([[:digit:]]+\.[[:digit:]]+ )(°C)/\2\3\t\1/g;s/(.000)//g;s/( Temp)//g'"

View file

@ -1,25 +0,0 @@
## mgrote.proxmox
### Beschreibung
Installiert ein Script um komplette Poools zu starten/stoppen.
### Funktioniert auf
- [x] ProxMox 6.1
### Variablen + Defaults
see [defaults](./defaults/main.yml)
### Erklärung start_pools.sh
#### Argumente
`$1, $2, $n` = gleich Parameter in der Schreibreihenfolge nach dem Aufruf, also
`./pools.sh Test start`
`Test = $1`
`start = $2`
möglich: Poolnamen(case-sensitiv) & start/stop/shutdown
#### RegEx
`sudo pvesh get /pools/$1 |` gibt alle VM/ct-Daten als JSON(?)-Objekt mit Formatierung aus
`sed -r 's#(,)#\n#g;s#\│##g;s#─##g;s#┴##g;s#└##g;s#┘##g;s#╞##g;s#╪##g;s#═##g;s#╡##g;s#\{##g;s#\}##g;s#\"*\"##g;s#\[##g;s#\]##g;s#id\:## g' |` erstellt Zeilenumbrüche, entfernt Formatierung, formatiert Text für grep
`grep -E 'qemu/[[:digit:]]{3}' |` sucht alle Zeilen aus die den Typ und die VMID enthalten
`sed -r 's#(qemu\/)([0-9]{3})#\2#g' | ` entfernt den Typ von der VMID
`sudo xargs -i --verbose qm "$2" {}` übergibt VMIDs an das PVE-Kommando mit xargs

View file

@ -1 +0,0 @@
---

View file

@ -1 +0,0 @@
---

View file

@ -1,7 +0,0 @@
---
- name: copy start_pools.sh
become: yes
ansible.builtin.template:
src: "start_pools.sh"
dest: "/usr/local/bin/start_pools.sh"
mode: a+x

View file

@ -1,8 +0,0 @@
#! /bin/bash
{% raw %}
# starte/stoppe Container
sudo pvesh get /pools/$1 | sed -r 's#(,)#\n#g;s#\│##g;s#─##g;s#┴##g;s#└##g;s#┘##g;s#╞##g;s#╪##g;s#═##g;s#╡##g;s#\{##g;s#\}##g;s#\"*\"##g;s#\[##g;s#\]##g;s#id\:##g' | grep -E 'lxc/[[:digit:]]{3}' | sed -r 's#(lxc\/)([0-9]{3})#\2#g' | sudo xargs -i sh -c "pct "$2" {} || true"
# starte/stoppe VMs
sudo pvesh get /pools/$1 | sed -r 's#(,)#\n#g;s#\│##g;s#─##g;s#┴##g;s#└##g;s#┘##g;s#╞##g;s#╪##g;s#═##g;s#╡##g;s#\{##g;s#\}##g;s#\"*\"##g;s#\[##g;s#\]##g;s#id\:##g' | grep -E 'qemu/[[:digit:]]{3}' | sed -r 's#(qemu\/)([0-9]{3})#\2#g' | sudo xargs -i sh -c "qm "$2" {} || true"
{% endraw %}

View file

@ -7,3 +7,11 @@
- zfs-initramfs
- zfs-zed
state: present
- name: copy zfs-free.sh
become: yes
ansible.builtin.template:
mode: 0555
src: zfs-free.sh
dest: /usr/local/bin/zfs-free.sh
when: "'proxmox' in group_names"