XOps CLI (IT Operations Automation Tool) Skill Guide
This skill empowers you to manage server clusters, execute batch tasks, and perform network security diagnostics via the XOps command-line tool (xops).
🎯 Environment Self-Check & Bootstrap Installation
Before attempting any operations, please run xops --version to check if the tool is installed.
If you receive a command not found error, instruct the user to execute the following installation command:
curl -sSL https://raw.githubusercontent.com/wentf9/xops-cli/master/install.sh | bash
🎯 Core Capabilities & Precise Command Usage
1. Host & Asset Management (xops host)
Manage the inventory of servers, credentials, and grouping tags.
- Initialize Local Configuration and Import OpenSSH Hosts:
xops init - List All Hosts:
xops host list - View All Unique Tags:
xops host tags - Add a New Host:
xops host add --address "192.168.1.10" --user "root" --key ~/.ssh/id_ed25519 --alias "web-01" --tags "web" - Batch Import Hosts from CSV:
xops host import hosts.csv --tag "production"
2. Batch Execution (xops exec)
Run commands or local scripts concurrently across multiple targets.
- Execute Command via Tag:
xops exec --tag "web" -c "uptime" - Run Local Script Remotely:
xops exec --tag "db" --shell "./backup.sh" --task 5
3. Distributed File Transfer (xops scp)
Transfer files or directories between local and remote hosts.
- Upload to Tagged Hosts:
xops scp ./config.conf --tag "web" --dest "/etc/app/"
4. Unified Firewall Management (xops firewall)
Abstracts different firewall backends (firewalld, ufw, iptables, nftables).
- List Rules for a Host:
xops firewall list -H "web-01" - Manage Ports:
#open port 80/tcp,81/tcp and reload firewall xops firewall port 80,81 -H "web-01" --reload #remove port 80/udp xops firewall port 80 --remove --proto udp -H "web-01" #allow port 80/tcp from source 192.168.0.1 xops firewall rule 80 192.168.0.1 -H "web-01"
5. Network & Security Tools
- Smart Ping (Supports ICMP and TCP port checks):
xops ping 1.1.1.1 # ICMP xops ping 1.1.1.1 443 # TCP Port Check - Netcat (nc) (Port scanning):
#listen on local port 8080 and print requests to stdout xops nc -l 8080 #send "scan me" to local port 8080 echo "scan me" | xops nc 127.0.0.1 8080 - DNS Diagnostics:
xops dns "google.com" - Data Encoding:
xops encode base64 "hello" xops encode base64 --decode "aGVsbG8="
🛠️ Execution Principles & Safety Guardrails
- Host Verification: Before executing batch tasks on a tag, run
xops host listto verify which hosts will be affected. - Non-Interactive Preference: Always prefer
xops execandxops scpoverxops sshorxops tuifor automation. - High-Risk Operations: You MUST obtain explicit user confirmation via
ask_userbefore running destructive commands (e.g.,rm -rf,format,systemctl stop) on multiple hosts. - Credential Protection: NEVER print or log passwords/keys used in
xops host addcommands.