feat(proxmox): added pve-stop and pve-start commands
This commit is contained in:
5
pve-service-scripts.yml
Normal file
5
pve-service-scripts.yml
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
- hosts: all
|
||||
become: true
|
||||
tasks:
|
||||
- import_tasks: tasks/proxmox/pve-service-scripts.yml
|
||||
72
tasks/proxmox/pve-service-scripts.yml
Normal file
72
tasks/proxmox/pve-service-scripts.yml
Normal file
@@ -0,0 +1,72 @@
|
||||
---
|
||||
- name: Ensure pve-stop script is installed
|
||||
ansible.builtin.copy:
|
||||
dest: /usr/local/bin/pve-stop
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0755"
|
||||
content: |
|
||||
#!/usr/bin/env bash
|
||||
# pve-stop — stop all Proxmox VE services in safe order.
|
||||
# HA daemons first (avoids watchdog fencing), pve-cluster (pmxcfs) last.
|
||||
set -u
|
||||
|
||||
SERVICES=(
|
||||
pve-ha-lrm # HA local resource manager — MUST stop before crm/corosync (watchdog!)
|
||||
pve-ha-crm # HA cluster resource manager
|
||||
pvescheduler # replication/backup job scheduler
|
||||
pvestatd # status daemon
|
||||
spiceproxy # SPICE console proxy
|
||||
pveproxy # web UI / API proxy (port 8006)
|
||||
pvedaemon # privileged REST API daemon
|
||||
pve-firewall # firewall
|
||||
pvefw-logger # firewall logger
|
||||
pve-lxc-syscalld # LXC syscall daemon
|
||||
qmeventd # QEMU event daemon
|
||||
corosync # cluster communication
|
||||
pve-cluster # pmxcfs (/etc/pve) — LAST
|
||||
)
|
||||
|
||||
for svc in "${SERVICES[@]}"; do
|
||||
echo "Stopping ${svc}..."
|
||||
systemctl stop "${svc}" 2>/dev/null || echo " (skipped: ${svc} not active/present)"
|
||||
done
|
||||
|
||||
echo "Done. Remaining running pve services:"
|
||||
systemctl -t service --state=running --no-legend --no-pager | grep -E 'pve|corosync' || echo " none"
|
||||
|
||||
- name: Ensure pve-start script is installed
|
||||
ansible.builtin.copy:
|
||||
dest: /usr/local/bin/pve-start
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0755"
|
||||
content: |
|
||||
#!/usr/bin/env bash
|
||||
# pve-start — start all Proxmox VE services in reverse order of pve-stop.
|
||||
# pve-cluster (pmxcfs) first, HA daemons last.
|
||||
set -u
|
||||
|
||||
SERVICES=(
|
||||
pve-cluster # pmxcfs (/etc/pve) — FIRST
|
||||
corosync # cluster communication (only starts if corosync.conf exists)
|
||||
qmeventd # QEMU event daemon
|
||||
pve-lxc-syscalld # LXC syscall daemon
|
||||
pvefw-logger # firewall logger
|
||||
pve-firewall # firewall
|
||||
pvedaemon # privileged REST API daemon
|
||||
pveproxy # web UI / API proxy (port 8006)
|
||||
spiceproxy # SPICE console proxy
|
||||
pvestatd # status daemon
|
||||
pvescheduler # replication/backup job scheduler
|
||||
pve-ha-crm # HA cluster resource manager
|
||||
pve-ha-lrm # HA local resource manager — LAST
|
||||
)
|
||||
|
||||
for svc in "${SERVICES[@]}"; do
|
||||
echo "Starting ${svc}..."
|
||||
systemctl start "${svc}" 2>/dev/null || echo " (skipped: ${svc} failed/not present)"
|
||||
done
|
||||
|
||||
echo "Done. Running pve services:"
|
||||
systemctl -t service --state=running --no-legend --no-pager | grep -E 'pve|corosync' || echo " none"
|
||||
Reference in New Issue
Block a user