Collection of scripts for running commands on remote hosts and managing host preparation.
Main script for running command groups on one or more remote hosts.
Features:
- Support for multiple hosts (comma-separated)
- Command groups for different purposes (prep_for_jenkins, maintenance, etc.)
- Automatic log file creation and download
- Summary reporting
Usage:
# Single host with default config
python3 run_commands_on_host.py myhost.example.com prep_for_jenkins
# Multiple hosts
python3 run_commands_on_host.py "host1,host2,host3" system_info
# With custom config file
python3 run_commands_on_host.py "host1,host2" prep_for_jenkins my_config.json
# List available command groups
python3 run_commands_on_host.py myhost.example.com --listOutput:
- Creates log files on remote hosts (
/tmp/host_prep_*.log) - Downloads logs to local
host_logs/directory - Shows summary with success/failure status
Utility script to clean up old log files.
Usage:
# List log files
python3 cleanup_logs.py list
# Clean up old logs (keep 10 most recent)
python3 cleanup_logs.py cleanup
# Clean up old logs (keep N most recent)
python3 cleanup_logs.py cleanup 20Script to provision Beaker hosts with RHEL distributions.
Features:
- Provision exact host with exact RHEL version
- Provision exact host with latest RHEL-X.Y
- Provision exact host with RHEL-X.Y that has specific kernel version
- Automatic job XML generation and submission
Usage:
# Scenario 1: Provision with exact distro name
python3 provision_host.py ampere-one-x-08.khw.eng.bos2.dc.redhat.com RHEL-10.2-20251103.1
# Scenario 2: Provision with latest RHEL version
python3 provision_host.py ampere-one-x-08.khw.eng.bos2.dc.redhat.com latest 10.1
# Scenario 3: Provision with specific kernel version
python3 provision_host.py ampere-one-x-08.khw.eng.bos2.dc.redhat.com kernel 9.6 5.14.0-636
# Watch job after submission
python3 provision_host.py ampere-one-x-08.khw.eng.bos2.dc.redhat.com latest 10.1 --watchOptions:
--watch, -w: Watch the job after submission--no-bkr: Do not use bkr-distros-list (use web scraping instead)
Output:
- Generates job XML file:
job_<hostname>.xml - Submits job to Beaker and returns job ID
- Provides job URL for tracking
Dependencies:
- Requires
bkrcommand line tool (beaker-client) - Requires valid Kerberos authentication (
kinitbefore use)
Main configuration file with command groups. Default config file used by run_commands_on_host.py.
Structure:
ssh_user: SSH username (default: root)ssh_options: SSH command line optionstimeout: Command timeout in secondscommand_groups: Dictionary of command groupsprep_for_jenkins: Prepare host for Jenkins jobsmaintenance: Maintenance commandscleanup: Cleanup commandssystem_info: System information gathering
Legacy configuration file (backward compatibility). Uses simple commands array format.
cursor-commands/
├── README.md
├── requirements.txt
├── run_commands_on_host.py
├── cleanup_logs.py
├── provision_host.py
├── find_kernel_version.py
├── commands_groups_config.json
├── commands_config.json
└── host_logs/ # Created automatically for downloaded logs
python3 run_commands_on_host.py "host1,host2,host3" prep_for_jenkinspython3 run_commands_on_host.py "host1.example.com,host2.example.com" system_infopython3 run_commands_on_host.py myhost.example.com maintenance# Provision with latest RHEL 10.1
python3 provision_host.py ampere-one-x-08.khw.eng.bos2.dc.redhat.com latest 10.1
# Provision with exact RHEL version
python3 provision_host.py ampere-one-x-07.khw.eng.bos2.dc.redhat.com RHEL-10.2-20251103.1Install Python dependencies:
pip install -r requirements.txtNote: For provision_host.py, you also need:
beaker-clientpackage (providesbkrcommand)- Valid Kerberos authentication (
kinitbefore use)