114 lines
2.3 KiB
Markdown
114 lines
2.3 KiB
Markdown
# netupgrade
|
|
|
|
Interactive CLI tool to run upgrade and maintenance actions on multiple remote hosts over SSH.
|
|
|
|
## Where to use
|
|
|
|
- On a dedicated server (bastion, jump host, ...)
|
|
- On your computer with an alias to your dedicated server
|
|
- On your computer directly (not recommended)
|
|
|
|
## Features
|
|
|
|
- Select one or more hosts from an interactive checklist
|
|
- Run predefined actions on each selected host
|
|
- Write execution logs to `~/netupgrade.log`
|
|
|
|
Supported actions:
|
|
|
|
- `apt`
|
|
- `yum`
|
|
- `pkg`
|
|
- `pacman`
|
|
- `apk`
|
|
- `reboot`
|
|
- `cmd:<remote command>`
|
|
- `docker-stacks:<directory>`
|
|
|
|
## Requirements
|
|
|
|
Required:
|
|
|
|
- `bash`
|
|
- `ssh`
|
|
- `whiptail`
|
|
- `sed`
|
|
- `tee`
|
|
- core utilities such as `rm` and `touch`
|
|
|
|
Optional log viewer:
|
|
|
|
- `$EDITOR` if it points to an installed command
|
|
- otherwise one of: `nano`, `vi`, `less`
|
|
|
|
## Install
|
|
|
|
### Install the executable
|
|
|
|
```bash README.md
|
|
cp bin/netupgrade /usr/local/bin/netupgrade
|
|
chmod +x /usr/local/bin/netupgrade
|
|
```
|
|
|
|
### Create the config directory
|
|
|
|
```bash README.md
|
|
mkdir -p ~/.config/netupgrade
|
|
touch ~/.config/netupgrade/index.cfg
|
|
```
|
|
|
|
### Alias on your computer with a dedicated server
|
|
|
|
You can save it in your `.bashrc`
|
|
|
|
```bash README.md
|
|
alias netupgrade='ssh -t user@10.0.0.10 netupgrade'
|
|
```
|
|
|
|
## Configuration
|
|
|
|
The default config file is:
|
|
|
|
```text README.md
|
|
~/.config/netupgrade/index.cfg
|
|
```
|
|
|
|
The script sources this file as Bash code. It must define a `NODES` array.
|
|
|
|
Each entry uses this format:
|
|
|
|
```text README.md
|
|
host;display-name;action1;action2;...
|
|
```
|
|
|
|
Example:
|
|
|
|
```bash README.md
|
|
NODES=(
|
|
"192.168.1.10;web-01;apt;reboot"
|
|
"192.168.1.11;db-01;apt;cmd:systemctl restart postgresql"
|
|
"192.168.1.12;docker-01;docker-stacks:/opt/stacks"
|
|
)
|
|
```
|
|
|
|
## Usage
|
|
|
|
```bash README.md
|
|
netupgrade [--help] [-f] [-y] [configfilename]
|
|
```
|
|
|
|
Options:
|
|
|
|
- `--help`: show help
|
|
- `-f`: preselect all nodes
|
|
- `-y`: pass non-interactive confirmation flags to supported package managers
|
|
- `configfilename`: path to a config file
|
|
|
|
## Notes
|
|
|
|
- SSH connections currently use `root@host`
|
|
- The tool is interactive and intended for manual administration workflows
|
|
- After execution, the log file is opened with `$EDITOR` when available, otherwise with `nano`, `vi`, or `less`
|
|
- If no supported log viewer is available, the script keeps running and prints the log file path
|
|
- The configuration file is sourced as shell code, so only use trusted config files
|