New
This commit is contained in:
BIN
Binary file not shown.
@@ -0,0 +1,48 @@
|
||||
#!/bin/bash
|
||||
echo "Idempotentes Hinzufügen von VMs und CTs zur HA (ohne Templates)..."
|
||||
|
||||
# Funktion zum Prüfen, ob eine HA-Ressource bereits existiert
|
||||
ha_exists() {
|
||||
local res="$1"
|
||||
ha-manager status | awk '{print $1}' | grep -qx "$res"
|
||||
}
|
||||
|
||||
# --- VMs (Qemu) ---
|
||||
for vmid in $(qm list | awk 'NR>1 {print $1}'); do
|
||||
|
||||
# Templates überspringen
|
||||
if qm config "$vmid" | grep -q "^template:\s*1"; then
|
||||
echo "VM $vmid ist ein Template → wird übersprungen."
|
||||
continue
|
||||
fi
|
||||
|
||||
resource="vm:$vmid"
|
||||
|
||||
if ha_exists "$resource"; then
|
||||
echo "VM $vmid ist bereits in HA → OK."
|
||||
else
|
||||
echo "VM $vmid wird zur HA hinzugefügt..."
|
||||
ha-manager add $resource --state started --max_restart 3 --max_relocate 3
|
||||
fi
|
||||
done
|
||||
|
||||
# --- CTs (LXC) ---
|
||||
for ctid in $(pct list | awk 'NR>1 {print $1}'); do
|
||||
|
||||
# Templates überspringen
|
||||
if pct config "$ctid" | grep -q "^template:\s*1"; then
|
||||
echo "CT $ctid ist ein Template → wird übersprungen."
|
||||
continue
|
||||
fi
|
||||
|
||||
resource="ct:$ctid"
|
||||
|
||||
if ha_exists "$resource"; then
|
||||
echo "CT $ctid ist bereits in HA → OK."
|
||||
else
|
||||
echo "CT $ctid wird zur HA hinzugefügt..."
|
||||
ha-manager add $resource --state started --max_restart 3 --max_relocate 3
|
||||
fi
|
||||
done
|
||||
|
||||
echo "Fertig."
|
||||
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
@@ -0,0 +1,48 @@
|
||||
logging {
|
||||
debug: off
|
||||
to_syslog: yes
|
||||
}
|
||||
|
||||
nodelist {
|
||||
node {
|
||||
name: pve-x-1
|
||||
nodeid: 1
|
||||
quorum_votes: 1
|
||||
ring0_addr: 10.1.99.XXX
|
||||
ring1_addr: 10.3.99.XXX
|
||||
}
|
||||
node {
|
||||
name: pve-x-2
|
||||
nodeid: 2
|
||||
quorum_votes: 1
|
||||
ring0_addr: 10.1.99.XXX
|
||||
ring1_addr: 10.3.99.XXX
|
||||
}
|
||||
node {
|
||||
name: pve-x-3
|
||||
nodeid: 3
|
||||
quorum_votes: 1
|
||||
ring0_addr: 10.1.99.XXX
|
||||
ring1_addr: 10.3.99.XXX
|
||||
}
|
||||
}
|
||||
|
||||
quorum {
|
||||
provider: corosync_votequorum
|
||||
}
|
||||
|
||||
totem {
|
||||
cluster_name: cluster-x
|
||||
config_version: 4
|
||||
interface {
|
||||
linknumber: 0
|
||||
}
|
||||
interface {
|
||||
linknumber: 1
|
||||
}
|
||||
ip_version: ipv4-6
|
||||
link_mode: passive
|
||||
secauth: on
|
||||
version: 2
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,89 @@
|
||||
# network interface settings; autogenerated
|
||||
# Please do NOT modify this file directly, unless you know what
|
||||
# you're doing.
|
||||
#
|
||||
# If you want to manage parts of the network configuration manually,
|
||||
# please utilize the 'source' or 'source-directory' directives to do
|
||||
# so.
|
||||
# PVE will preserve these directives, but will NOT read its network
|
||||
# configuration from sourced files, so do not attempt to move any of
|
||||
# the PVE managed interfaces into external files!
|
||||
|
||||
auto lo
|
||||
iface lo inet loopback
|
||||
|
||||
auto ens18
|
||||
iface ens18 inet manual
|
||||
# Karte 10GBPS
|
||||
|
||||
auto ens19
|
||||
iface ens19 inet manual
|
||||
|
||||
auto ens20
|
||||
iface ens20 inet static
|
||||
address 10.2.99.XXX/24
|
||||
#Corosync Link 0
|
||||
|
||||
auto ens21
|
||||
iface ens21 inet static
|
||||
address 10.3.99.XXX/24
|
||||
#Corosync Link 1
|
||||
|
||||
auto ens22
|
||||
iface ens22 inet manual
|
||||
|
||||
auto ens23
|
||||
iface ens23 inet manual
|
||||
|
||||
auto bond0
|
||||
iface bond0 inet manual
|
||||
bond-slaves ens18 ens19
|
||||
bond-miimon 100
|
||||
bond-mode active-backup
|
||||
bond-primary ens18
|
||||
#Bond0 nach aussen
|
||||
|
||||
auto bond1
|
||||
iface bond1 inet manual
|
||||
bond-slaves ens22 ens23
|
||||
bond-miimon 100
|
||||
bond-mode active-backup
|
||||
bond-primary ens22
|
||||
#Bond1 zum Ceph Storage
|
||||
|
||||
auto vmbr0
|
||||
iface vmbr0 inet static
|
||||
address 10.1.99.XXX/24
|
||||
gateway 10.1.99.254
|
||||
bridge-ports bond0
|
||||
bridge-stp off
|
||||
bridge-fd 0
|
||||
#Bridge nach aussen
|
||||
|
||||
source /etc/network/interfaces.d/*
|
||||
|
||||
auto vmbr1
|
||||
iface vmbr1 inet static
|
||||
address 192.168.127.254/24
|
||||
bridge-ports none
|
||||
bridge-stp off
|
||||
bridge-fd 0
|
||||
pre-up iptables -t nat -A POSTROUTING -s '192.168.127.0/24' -o vmbr0 -j MASQUERADE
|
||||
pre-up echo 1 > /proc/sys/net/ipv4/ip_forward
|
||||
post-down iptables -t nat -F
|
||||
# END ANSIBLE MANAGED BLOCK
|
||||
|
||||
auto Ceph_public
|
||||
iface Ceph_public inet static
|
||||
address 10.4.99.XXX/24
|
||||
vlan-id 50
|
||||
vlan-raw-device bond1
|
||||
#Ceph_public
|
||||
|
||||
auto Ceph_cluster
|
||||
iface Ceph_cluster inet static
|
||||
address 10.5.99.XXX/24
|
||||
vlan-id 51
|
||||
vlan-raw-device bond1
|
||||
#Ceph_cluster
|
||||
|
||||
Binary file not shown.
BIN
Binary file not shown.
Reference in New Issue
Block a user