====== Spacecmd ====== **General Information** Spacewalk provides centralized management of Red Hat systems. * Official Site: https://fedorahosted.org/spacewalk/) * Local Wiki Page: [[linux_wiki:spacewalk]] Spacecmd is the command line interface to the server and is much faster than logging into the web portal. **Checklist** * Distro(s): Enterprise Linux * Other: [[https://fedorahosted.org/spacewalk/wiki/HowToInstall|Spacewalk server]] setup * Other: Spacewalk user account created ---- ===== Install Spacecmd ===== * Add spacewalk client repo * CentOS 6rpm -Uvh http://yum.spacewalkproject.org/2.4-client/RHEL/6/x86_64/spacewalk-client-repo-2.4-3.el6.noarch.rpm * CentOS 7rpm -Uvh http://yum.spacewalkproject.org/2.4-client/RHEL/7/x86_64/spacewalk-client-repo-2.4-3.el7.noarch.rpm * Install spacecmd * yum install spacecmd ---- ===== Spacecmd Config File ===== Setting up the spacecmd config file greatly shortens the command, as you do not have to specify server, username, and password each time. Create the file ~/.spacecmd/config mkdir ~/.spacecmd chmod 700 ~/.spacecmd touch ~/.spacecmd/config chmod 600 ~/.spacecmd/config Edit the file vim ~/.spacecmd/config [spacecmd] server=spacewalkserver.mydomain.com username=usernamehere password=passwordhere Verify configuration by testing connectivity spacecmd ---- ===== Useful Alias ===== It is also useful to create the following alias in your ~/.bashrc file alias spacecmd='spacecmd -q' This will always execute spacecmd with the quiet option. This will not show logging into the server info, which just gets in the way if you are trying to pipe output to other commands. ---- ===== Clear Caches ===== Spacecmd creates a local cache of system queries to improve performance. This can leave you with outdated information when working at the CLI in some situations. To clear the local cache spacecmd clear_caches ---- ===== Group Commands ===== List system groups spacecmd group_list List systems in a group spacecmd group_listsystems Add systems to a group (SYSTEMS space separated) spacecmd group_addsystems Remove systems from a group (SYSTEMS space separated) spacecmd group_removesystems ===== System Commands ===== List all systems (good for piping to grep) spacecmd system_list Delete system(s) from Spacewalk (SYSTEMS space separated) spacecmd system_delete List a System's Base Channel spacecmd system_listbasechannel List a System's Child Channels spacecmd system_listchildchannels Set an entire group's base channel spacecmd -y system_setbasechannel group: List systems in a group and all errata except kernel: spacecmd system_listerrata group: | grep -vi "kernel" Errata install command: spacecmd -y system_applyerrata group: List installed packages, grep for glibc: spacecmd system_listinstalledpackages | grep glibc ---- ===== Report Commands ===== Systems Not in Any Group spacecmd report_ungroupedsystems Systems Not Checking In and Last Checkin Time spacecmd report_inactivesystems ----