spacecmd - a command line interface to Spacewalk Author: Aron Parsons <aron@redhat.com> Homepage: http://github.com/aparsons/spacecmd License: GPL # Requirements - >= python-2.4 - >= Satellite 5.3 (v10.8 of the API) # Highlights - view and manage nearly every aspect of Satellite - tab completion - can be passed single commands (useful for shell scripts) - can be used as an interactive shell - advanced searching of systems allows systems to be managed without having to create system groups - all functionality implemented via the Satellite API # Examples # # add and remove packages from the commandline # [user@sat]$ spacecmd -y system_installpackage www* mod_python Scheduled 6 system(s) [user@sat]$ spacecmd -y system_removepackage wiki02 mod_perl Scheduled 1 system(s) # # apply errata from the command line # [user@sat]$ spacecmd -y errata_apply RHSA-2010:0423 Scheduled 42 system(s) [user@sat]$ spacecmd -y system_applyerrata group:web_servers RHSA-2010:0040 Scheduled 16 system(s) # # access information on the command line without writing custom API scripts # [root@sat]# spacecmd get_entitlements | grep -e monitoring -e provisioning monitoring_entitled: 314/397 provisioning_entitled: 322/397 # # quickly generate reports # spacecmd> system_listerrata ldap03 System: ldap03 Security Errata: RHSA-2010:0458 Moderate: perl security update 6/7/10 RHSA-2010:0449 Moderate: rhn-client-tools security update 6/1/10 RHSA-2010:0423 Important: krb5 security update 5/18/10 spacecmd> report_errata # Systems Errata --------- ------ CLA-2010:0474 88 CLA-2010:0475 6 CLA-2010:0488 183 CLA-2010:0490 273 CLA-2010:0500 4 CLA-2010:0501 5 RHBA-2010:0402 1 RHSA-2010:0474 2 RHSA-2010:0488 1 RHSA-2010:0490 5 spacecmd> report_outofdatesystems System Packages ------ -------- monkey 310 shark 63 hedgehog 39 pomeranian 4 spacecmd> report_ipaddresses System Hostname IP ------ -------- -- dns01 dns01.dmz.example.com 192.168.254.53 www01 www01.dmz.example.com 192.168.254.80 ztest ztest.test.example.com 192.168.42.111 spacecmd> report_kernels System Kernel ------ ------ system01 2.6.9-89.0.25.ELsmp system02 2.6.9-89.0.3.ELsmp system03 2.6.9-89.0.26.ELsmp # # make temporary groups on-the-fly # spacecmd> ssm_add search:driver:bnx2 Systems Selected: 111 spacecmd> ssm_add search:device:vmware Systems Selected: 285 spacecmd> ssm_add search:hostname:external.example.com Systems Selected: 16 # # tab completion of everything # spacecmd> system_installpackage ssm vmware-tools [tab] vmware-tools vmware-tools-kmod vmware-tools-common vmware-tools-nox # # easily view system information # spacecmd> system_details www01.example.com Name: www01.example.com System ID: 1000010001 Locked: False Registered: 20100311 19:31:36 Last Checkin: 20100621 18:31:53 OSA Status: online Hostname: www01.example.com IP Address: 192.168.1.80 Kernel: 2.6.18-164.el5 Software Channels: custom-rhel-i386-server-5 |-- custom-extras-i386-rhel5 |-- clone-rhn-tools-rhel-i386-server-5 Configuration Channels: sudoers base base-rhel5 Entitlements: Management Monitoring Provisioning System Groups: all_linux_systems all_linux_VMs rhel5-i386