Added basic proxmox login check script & playbook

main
WhatTheMike 2 years ago
parent 5df667e0eb
commit 2504800429

@ -0,0 +1,82 @@
#!/bin/bash
# space-delimited list of services to check
servicelist=(corosync)
echo -e "\n"
echo -e "$(tput smul)Service Check$(tput sgr0)\n"
for service in ${servicelist[@]}; do
echo -e "${service}:"
systemctl status $service | grep Active: | tr -s [:blank:]
echo
done
echo
#Sections: Rows:
# Cluster information 4
# Quorum information 6 (5 necessary)
# Votequorum information 5
# Membership information 4
colover=30
function uplines {
[ -z $1 ] && return
lines=$1
while [ $lines -gt 0 ]; do
tput cuu1
let lines=lines-1
done
}
statcmd='pvecm status'
currentrow='Cluster information'
linec=0
while read -r line; do
if [[ "$currentrow" == "Cluster information" ]]; then
if [[ "$line" == "Quorum information" ]]; then
currentrow="$line"
linec=0
continue
fi
echo $line
fi
if [[ "$currentrow" == "Quorum information" ]]; then
if [[ "$line" == "Votequorum information" ]]; then
currentrow="$line"
linec=0
echo $line
continue
fi
if [[ "$line" == "Date"* ]]; then
continue
fi
if [ $linec -eq 0 ]; then
uplines 7; tput cuf $colover; echo -e "$currentrow"
fi
tput cuf $colover
echo $line
let linec=linec+1
fi
if [[ "$currentrow" == "Votequorum information" ]]; then
if [[ "$line" == "Membership information" ]]; then
currentrow="$line"
linec=0
continue
fi
echo $line
fi
if [[ "$currentrow" == "Membership information" ]]; then
if [ $linec -eq 0 ]; then
uplines 8; tput cuf $colover; echo -e "$currentrow"
fi
tput cuf $colover
echo $line
let linec=linec+1
fi
done <<< $($statcmd)
echo
echo
echo "$(tput sitm)run the $(basename $0) script in $(dirname $0) to get these stats again$(tput sgr0)"
echo

@ -0,0 +1,21 @@
---
- name: Proxmox maintenance
hosts: proxmox
tasks:
- name: Ensuring login-check is present
ansible.builtin.copy:
src: /home/michael/ansible/files/prox-login-check.sh
dest: /root/prox-login-check
mode: "0755"
- name: Ensuring login-check is configured to run on login
ansible.builtin.lineinfile:
state: present
insertafter: "EOF"
line: "/root/prox-login-check"
path: /root/.profile
- name: Download vim config from aperture
ansible.builtin.get_url:
dest: ~/.vimrc
url: https://aperture.dismyserver.net/.vimrc
Loading…
Cancel
Save