Automate installer more
CI / Build & Test (push) Has been cancelled

This commit is contained in:
Raven Scott
2026-03-16 13:33:54 -04:00
parent 6e9fa5dbbc
commit 4a4901902f
6 changed files with 132 additions and 23 deletions
+6 -6
View File
@@ -10,9 +10,9 @@ Requires the **anisail-tunnel** binary (Bare-built, shipped in `releases/` or bu
## Installation
### 0. Install the tunnel binary (from release)
### 0. One-command install (recommended)
To install **anisail-tunnel** from the [latest release](https://git.ssh.surf/snxraven/anisail/releases/tag/latest-main) without building:
To install **anisail-tunnel**, the **Ansible collection**, and **paramiko** from the [latest release](https://git.ssh.surf/snxraven/anisail/releases/tag/latest-main):
**macOS / Linux:**
@@ -26,11 +26,11 @@ curl -fsSL https://git.ssh.surf/snxraven/anisail/raw/branch/main/scripts/install
irm https://git.ssh.surf/snxraven/anisail/raw/branch/main/scripts/install.ps1 | iex
```
The script downloads the right binary for your platform, extracts it to `~/.anisail/bin` (or `%LOCALAPPDATA%\anisail\bin` on Windows), and optionally links it into `~/.local/bin` on Unix. See [docs/INSTALLATION.md](docs/INSTALLATION.md) for details, custom install paths, and build-from-source.
The script installs the tunnel binary (to `~/.anisail/bin` or `%LOCALAPPDATA%\anisail\bin` on Windows), installs **paramiko** if missing, and installs the **anisail.anisail** collection (from Galaxy or the repo). See [docs/INSTALLATION.md](docs/INSTALLATION.md) for details, custom install paths, and build-from-source.
### 1. Install the collection
### 1. Install the collection manually (if needed)
From the repo root (or after building the collection artifact):
If the install script could not install the collection (e.g. Ansible not installed yet), from the repo root:
```bash
ansible-galaxy collection install ansible_collections/anisail/anisail/ --force
@@ -68,7 +68,7 @@ cp -r releases/* ansible_collections/anisail/anisail/releases/
Install the binary somewhere on `PATH` and name it `anisail-tunnel`. The plugin will use it if `ansible_holesail_tunnel_path` is not set and no collection-relative binary is found.
### 3. Install Paramiko (required)
### 3. Install Paramiko (if not installed by the script)
```bash
pip install paramiko
+24 -6
View File
@@ -4,9 +4,15 @@ This guide covers installing the **anisail-tunnel** binary (used by the Ansible
---
## Quick install (tunnel binary from release)
## Quick install (one command)
Use the install script to download the tunnel binary for your platform from the [latest release](https://git.ssh.surf/snxraven/anisail/releases/tag/latest-main).
Use the install script to set up **anisail-tunnel**, the **Ansible collection**, and **paramiko** from the [latest release](https://git.ssh.surf/snxraven/anisail/releases/tag/latest-main).
The script:
1. Downloads and installs the tunnel binary for your platform.
2. Installs **paramiko** with `pip` if it is not already installed.
3. Installs the **anisail.anisail** collection (from Ansible Galaxy if available, otherwise from the repo archive).
### macOS / Linux
@@ -65,8 +71,10 @@ irm https://git.ssh.surf/snxraven/anisail/raw/branch/main/scripts/install.ps1 |
5. Extracts the binary (handles zip layout with or without a subdir).
6. Sets the binary to `~/.anisail/bin/anisail-tunnel` and makes it executable.
7. If `~/.local/bin` exists, creates a symlink there so the binary is on PATH for many setups.
8. **Paramiko:** runs `python3 -c "import paramiko"`; if missing, runs `pip3 install paramiko` (or `pip install paramiko`).
9. **Collection:** if `ansible-galaxy` is available, runs `ansible-galaxy collection install anisail.anisail --force`. If that fails (e.g. not on Galaxy), downloads the repo archive and installs the collection from the extracted path.
**Requirements:** `curl`, `unzip`.
**Requirements:** `curl`, `unzip`. For collection install from archive, `ansible-galaxy` must be on PATH.
### Windows (`install.ps1`)
@@ -74,14 +82,18 @@ irm https://git.ssh.surf/snxraven/anisail/raw/branch/main/scripts/install.ps1 |
2. Extracts to `%LOCALAPPDATA%\anisail\bin` (or `ANISAIL_INSTALL_DIR`).
3. Ensures `anisail-tunnel.exe` is at the install dir root.
4. Suggests adding the install dir to the user PATH.
5. **Paramiko:** checks for `import paramiko`; if missing, runs `pip install paramiko` (or `pip3`).
6. **Collection:** if `ansible-galaxy` is available, tries Galaxy first, then falls back to installing from the repo archive (same as Unix).
**Requirements:** PowerShell, internet access. No extra tools (uses `Invoke-WebRequest` and `Expand-Archive`).
**Requirements:** PowerShell, internet access. No extra tools for the binary (uses `Invoke-WebRequest` and `Expand-Archive`).
---
## Install the Ansible collection and paramiko
## Install the Ansible collection and paramiko (manual)
The connection plugin runs on your Ansible control node and needs the collection plus Python paramiko.
If you did not use the install script, or it could not install the collection or paramiko, install them manually.
The connection plugin runs on your Ansible control node and needs the collection plus Python paramiko. **The install script installs both automatically** when you run it; this section is for manual or development setups.
### Collection
@@ -91,6 +103,12 @@ From the repo (development):
ansible-galaxy collection install ansible_collections/anisail/anisail/ --force
```
From Ansible Galaxy (if published):
```bash
ansible-galaxy collection install anisail.anisail --force
```
Or set the collection path and use the repo as-is:
```bash
+6 -2
View File
@@ -32,7 +32,9 @@ curl -fsSL https://git.ssh.surf/snxraven/anisail/raw/branch/main/scripts/install
7. Move the binary to the install dir root; remove empty subdirs left by the zip.
8. `chmod +x` the binary.
9. If `~/.local/bin` exists and is not the install dir, create a symlink `~/.local/bin/anisail-tunnel` → the installed binary.
10. Print the binary path and next steps (PATH, collection, paramiko, inventory).
10. **Paramiko:** run `python3 -c "import paramiko"`; if that fails, run `pip3 install paramiko` or `pip install paramiko`. On failure, print a warning and continue.
11. **Collection:** if `ansible-galaxy` is in PATH, run `ansible-galaxy collection install anisail.anisail --force`. If that fails (e.g. collection not on Galaxy), derive repo archive URL from `RELEASE_BASE` (replace `/releases/download/...` with `/archive/branch/main.zip`), download and extract to a temp dir, find `ansible_collections/anisail/anisail` inside, and run `ansible-galaxy collection install <path> --force`. On failure, print a warning with manual install instructions.
12. Print the binary path and next steps (PATH, inventory).
**Uninstall:** Remove the install directory and, if you used the symlink, remove it:
@@ -71,7 +73,9 @@ irm https://git.ssh.surf/snxraven/anisail/raw/branch/main/scripts/install.ps1 |
5. Find `anisail-tunnel.exe` (recursively if the zip has a subdir).
6. Move the exe to the install dir root; remove empty subdirs.
7. Optionally suggest adding the install dir to the user PATH via `[Environment]::SetEnvironmentVariable('Path', ...)`.
8. Print the binary path and next steps.
8. **Paramiko:** run `python -c "import paramiko"`; if that fails, run `pip install paramiko` or `pip3 install paramiko`. On failure, print a warning and continue.
9. **Collection:** if `ansible-galaxy` is available, try `ansible-galaxy collection install anisail.anisail --force`. If that fails, derive repo archive URL from `$ReleaseBase`, download and expand to a temp dir, find the directory that contains `meta\galaxy.yml` (the collection root), and run `ansible-galaxy collection install <path> --force`. On failure, print a warning with manual install instructions.
10. Print the binary path and next steps.
**Uninstall:** Remove the install directory and, if you added it, remove the install dir from the user PATH in System Properties → Environment Variables.
+1 -1
View File
@@ -112,4 +112,4 @@ Set **ansible_holesail_tunnel_path** when:
- You have **multiple** installs and want to force a specific binary.
- You run Ansible from **CI/automation** where PATH may not include the install directory.
If the binary is on PATH or is placed in the collections `bin/` or `releases/<platform>/`, you can leave **ansible_holesail_tunnel_path** unset. See [INSTALLATION.md](INSTALLATION.md) for install options and [TROUBLESHOOTING.md](TROUBLESHOOTING.md) for “binary not found” fixes.
If the binary is on PATH or is placed in the collections `bin/` or `releases/<platform>/`, you can leave **ansible_holesail_tunnel_path** unset. The [install script](INSTALLATION.md#quick-install-one-command) installs the tunnel, the collection, and paramiko in one go; see [INSTALLATION.md](INSTALLATION.md) for options and [TROUBLESHOOTING.md](TROUBLESHOOTING.md) for “binary not found” fixes.
+48 -4
View File
@@ -68,6 +68,53 @@ if ($UserPath -and $UserPath -notlike "*$BinDir*") {
Write-Host " Then restart your terminal." -ForegroundColor Yellow
}
# ── Install paramiko if missing ─────────────────────────────────────────────────
Write-Host ""
Write-Host "Checking Python dependency (paramiko)..."
python -c "import paramiko" 2>$null
if ($LASTEXITCODE -eq 0) {
Write-Host " paramiko already installed"
} else {
Write-Host " Installing paramiko..."
$pipOk = $false
pip install paramiko 2>$null; if ($LASTEXITCODE -eq 0) { $pipOk = $true }
if (-not $pipOk) { pip3 install paramiko 2>$null; if ($LASTEXITCODE -eq 0) { $pipOk = $true } }
if ($pipOk) { Write-Host " Installed paramiko" } else { Write-Host " Warning: could not install paramiko. Install manually: pip install paramiko" -ForegroundColor Yellow }
}
# ── Install Ansible collection ──────────────────────────────────────────────────
Write-Host ""
Write-Host "Installing Ansible collection (anisail.anisail)..."
$galaxyCmd = Get-Command ansible-galaxy -ErrorAction SilentlyContinue
if ($galaxyCmd) {
$galaxyOk = $false
ansible-galaxy collection install anisail.anisail --force 2>$null
if ($LASTEXITCODE -eq 0) { $galaxyOk = $true; Write-Host " Installed from Ansible Galaxy" }
if (-not $galaxyOk) {
$RepoBase = $ReleaseBase -replace "/releases/download/.*$", ""
$ArchiveUrl = "$RepoBase/archive/branch/main.zip"
$TmpCollection = Join-Path $env:TEMP "anisail-collection-$(Get-Random)"
New-Item -ItemType Directory -Path $TmpCollection -Force | Out-Null
try {
Invoke-WebRequest $ArchiveUrl -OutFile (Join-Path $TmpCollection "repo.zip") -UseBasicParsing -ErrorAction Stop
Expand-Archive (Join-Path $TmpCollection "repo.zip") -DestinationPath $TmpCollection -Force
$CollectionDir = Get-ChildItem -Path $TmpCollection -Recurse -Directory -Filter "anisail" -ErrorAction SilentlyContinue | Where-Object { Test-Path (Join-Path $_.FullName "meta\galaxy.yml") } | Select-Object -First 1 -ExpandProperty FullName
if ($CollectionDir) {
ansible-galaxy collection install $CollectionDir --force 2>$null
if ($LASTEXITCODE -eq 0) { Write-Host " Installed from repo archive"; $galaxyOk = $true }
}
} catch { }
Remove-Item $TmpCollection -Recurse -Force -ErrorAction SilentlyContinue
if (-not $galaxyOk) {
Write-Host " Warning: could not install collection (Galaxy and archive failed). Install manually:" -ForegroundColor Yellow
Write-Host " ansible-galaxy collection install ansible_collections/anisail/anisail/ --force" -ForegroundColor Yellow
}
}
} else {
Write-Host " Warning: ansible-galaxy not found. Install Ansible, then run:" -ForegroundColor Yellow
Write-Host " ansible-galaxy collection install anisail.anisail --force" -ForegroundColor Yellow
}
# ── Done ───────────────────────────────────────────────────────────────────────
Write-Host ""
Write-Host "========================" -ForegroundColor Green
@@ -76,10 +123,7 @@ Write-Host ""
Write-Host "Binary: $Bin"
Write-Host ""
Write-Host "Next steps:"
Write-Host " 1. Install the Ansible collection and paramiko:"
Write-Host " ansible-galaxy collection install ansible_collections/anisail/anisail/ --force"
Write-Host " pip install paramiko"
Write-Host " 2. In inventory set: ansible_connection: anisail.anisail.holesail"
Write-Host " 1. In inventory set: ansible_connection: anisail.anisail.holesail"
Write-Host " and ansible_holesail_key: ""hs://..."" (from target: holesail --live 22)"
Write-Host ""
Write-Host "Optional: set ansible_holesail_tunnel_path to use this binary explicitly:"
+47 -4
View File
@@ -94,6 +94,52 @@ if [[ -d "$LOCAL_BIN" ]] && [[ "$INSTALL_DIR" != "$LOCAL_BIN" ]]; then
echo " Linked: ${LOCAL_BIN}/${BIN_NAME}"
fi
# ── Install paramiko if missing ─────────────────────────────────────────────────
echo ""
echo "Checking Python dependency (paramiko)..."
if python3 -c "import paramiko" 2>/dev/null; then
echo " paramiko already installed"
else
echo " Installing paramiko..."
if pip3 install paramiko 2>/dev/null; then
echo " Installed paramiko (pip3)"
elif pip install paramiko 2>/dev/null; then
echo " Installed paramiko (pip)"
else
echo " Warning: could not install paramiko. Install manually: pip install paramiko" >&2
fi
fi
# ── Install Ansible collection ──────────────────────────────────────────────────
echo ""
echo "Installing Ansible collection (anisail.anisail)..."
if command -v ansible-galaxy >/dev/null 2>&1; then
if ansible-galaxy collection install anisail.anisail --force 2>/dev/null; then
echo " Installed from Ansible Galaxy"
else
# Fallback: install from repo archive (e.g. Gitea)
REPO_BASE="${RELEASE_BASE%/releases/download/*}"
ARCHIVE_URL="${REPO_BASE}/archive/branch/main.zip"
TMP_COLLECTION="$(mktemp -d)"
if curl -fsSL "$ARCHIVE_URL" -o "${TMP_COLLECTION}/repo.zip" 2>/dev/null && unzip -q -o "${TMP_COLLECTION}/repo.zip" -d "${TMP_COLLECTION}" 2>/dev/null; then
COLLECTION_DIR="$(find "$TMP_COLLECTION" -type d -path "*/ansible_collections/anisail/anisail" 2>/dev/null | head -1)"
if [[ -n "$COLLECTION_DIR" ]] && ansible-galaxy collection install "$COLLECTION_DIR" --force 2>/dev/null; then
echo " Installed from repo archive"
else
echo " Warning: could not install collection from archive. Install manually:" >&2
echo " ansible-galaxy collection install ansible_collections/anisail/anisail/ --force" >&2
fi
else
echo " Warning: could not install collection (Galaxy and archive failed). Install manually:" >&2
echo " ansible-galaxy collection install ansible_collections/anisail/anisail/ --force" >&2
fi
rm -rf "$TMP_COLLECTION"
fi
else
echo " Warning: ansible-galaxy not found. Install Ansible, then run:" >&2
echo " ansible-galaxy collection install anisail.anisail --force" >&2
fi
# ── Done ───────────────────────────────────────────────────────────────────────
echo ""
echo "========================"
@@ -104,10 +150,7 @@ echo ""
echo "Next steps:"
echo " 1. Add to PATH if needed: export PATH=\"${INSTALL_DIR}:\$PATH\""
echo " (or add the above to your shell profile)"
echo " 2. Install the Ansible collection and paramiko:"
echo " ansible-galaxy collection install ansible_collections/anisail/anisail/ --force"
echo " pip install paramiko"
echo " 3. In inventory set: ansible_connection: anisail.anisail.holesail"
echo " 2. In inventory set: ansible_connection: anisail.anisail.holesail"
echo " and ansible_holesail_key: \"hs://...\" (from target: holesail --live 22)"
echo ""
echo "Optional: set ansible_holesail_tunnel_path to use this binary explicitly:"