# Copy Script to Proxmox Nodes - Instructions

**Script**: `complete-vm-100-guest-agent-check.sh`  
**Target**: Both Proxmox nodes (ml110-01 and r630-01)

---

## Issue

The automated copy script cannot connect to the Proxmox nodes. This may be due to:
- Network connectivity issues
- Incorrect password in `.env` file
- SSH access restrictions
- Firewall rules

---

## Solution: Manual Copy

### Option 1: Using SCP (Recommended)

**For ml110-01 (Site 1 - 192.168.11.10):**

```bash
# Load password from .env (adjust if needed)
source .env
PROXMOX_PASS="${PROXMOX_ROOT_PASS:-L@kers2010}"

# Copy script
sshpass -p "$PROXMOX_PASS" scp -o StrictHostKeyChecking=no \
  scripts/complete-vm-100-guest-agent-check.sh \
  root@192.168.11.10:/usr/local/bin/complete-vm-100-guest-agent-check.sh

# Make executable
sshpass -p "$PROXMOX_PASS" ssh -o StrictHostKeyChecking=no root@192.168.11.10 \
  'chmod +x /usr/local/bin/complete-vm-100-guest-agent-check.sh'

# Verify
sshpass -p "$PROXMOX_PASS" ssh -o StrictHostKeyChecking=no root@192.168.11.10 \
  'ls -lh /usr/local/bin/complete-vm-100-guest-agent-check.sh'
```

**For r630-01 (Site 2 - 192.168.11.11):**

```bash
# Copy script
sshpass -p "$PROXMOX_PASS" scp -o StrictHostKeyChecking=no \
  scripts/complete-vm-100-guest-agent-check.sh \
  root@192.168.11.11:/usr/local/bin/complete-vm-100-guest-agent-check.sh

# Make executable
sshpass -p "$PROXMOX_PASS" ssh -o StrictHostKeyChecking=no root@192.168.11.11 \
  'chmod +x /usr/local/bin/complete-vm-100-guest-agent-check.sh'

# Verify
sshpass -p "$PROXMOX_PASS" ssh -o StrictHostKeyChecking=no root@192.168.11.11 \
  'ls -lh /usr/local/bin/complete-vm-100-guest-agent-check.sh'
```

---

### Option 2: Copy Script Content Directly

If SCP doesn't work, you can copy the script content directly:

1. **Display the script content:**
   ```bash
   cat scripts/complete-vm-100-guest-agent-check.sh
   ```

2. **SSH to the Proxmox node:**
   ```bash
   sshpass -p "$PROXMOX_PASS" ssh -o StrictHostKeyChecking=no root@192.168.11.10
   ```

3. **On the Proxmox node, create the file:**
   ```bash
   cat > /usr/local/bin/complete-vm-100-guest-agent-check.sh << 'SCRIPT_EOF'
   [paste the entire script content here]
   SCRIPT_EOF
   
   chmod +x /usr/local/bin/complete-vm-100-guest-agent-check.sh
   ```

4. **Verify:**
   ```bash
   /usr/local/bin/complete-vm-100-guest-agent-check.sh
   ```

---

### Option 3: Use Proxmox Web UI

1. **Access Proxmox Web UI** for each node
2. **Go to Shell** (or use the console)
3. **Create the file** using the web editor or paste the script content
4. **Make it executable:**
   ```bash
   chmod +x /usr/local/bin/complete-vm-100-guest-agent-check.sh
   ```

---

## Verify Script is Installed

After copying, verify on each node:

```bash
# On ml110-01
sshpass -p "$PROXMOX_PASS" ssh -o StrictHostKeyChecking=no root@192.168.11.10 \
  '/usr/local/bin/complete-vm-100-guest-agent-check.sh'

# On r630-01
sshpass -p "$PROXMOX_PASS" ssh -o StrictHostKeyChecking=no root@192.168.11.11 \
  '/usr/local/bin/complete-vm-100-guest-agent-check.sh'
```

---

## Troubleshooting

### If "Permission denied" error:

1. **Check password in `.env` file:**
   ```bash
   grep PROXMOX_ROOT_PASS .env
   ```

2. **Try connecting manually to verify:**
   ```bash
   ssh root@192.168.11.10
   ```

3. **Check if password authentication is enabled** (may need key-based auth)

### If "Connection refused" or "Host unreachable":

1. **Verify network connectivity:**
   ```bash
   ping 192.168.11.10
   ping 192.168.11.11
   ```

2. **Check if SSH is running on Proxmox nodes:**
   ```bash
   nmap -p 22 192.168.11.10
   nmap -p 22 192.168.11.11
   ```

3. **Verify firewall rules** allow SSH access

---

## Quick Reference

**Script Location**: `scripts/complete-vm-100-guest-agent-check.sh`  
**Target Location**: `/usr/local/bin/complete-vm-100-guest-agent-check.sh`  
**Nodes**: 
- ml110-01: `192.168.11.10`
- r630-01: `192.168.11.11`

**Password**: Check `.env` file for `PROXMOX_ROOT_PASS`

---

**Last Updated**: 2025-12-11

