linux_wiki:spacecmd_spacewalk_cmd_line

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
linux_wiki:spacecmd_spacewalk_cmd_line [2015/10/14 12:16]
billdozor [Spacecmd]
linux_wiki:spacecmd_spacewalk_cmd_line [2019/05/25 23:50] (current)
Line 3: Line 3:
 **General Information** **General Information**
  
-Spacewalk provides centralized management of Red Hat systems. (https://fedorahosted.org/spacewalk/\\+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. Spacecmd is the command line interface to the server and is much faster than logging into the web portal.
  
 **Checklist** **Checklist**
-  * Spacewalk server setup +  * Distro(s): Enterprise Linux 
-  * Spacewalk user account created+  * Other: [[https://fedorahosted.org/spacewalk/wiki/HowToInstall|Spacewalk server]] setup 
 +  * Other: Spacewalk user account created 
 + 
 +---- 
 + 
 +===== Install Spacecmd ===== 
 + 
 +  * Add spacewalk client repo 
 +    * CentOS 6<code bash>rpm -Uvh http://yum.spacewalkproject.org/2.4-client/RHEL/6/x86_64/spacewalk-client-repo-2.4-3.el6.noarch.rpm</code> 
 +    * CentOS 7<code bash>rpm -Uvh http://yum.spacewalkproject.org/2.4-client/RHEL/7/x86_64/spacewalk-client-repo-2.4-3.el7.noarch.rpm</code> 
 +  * Install spacecmd 
 +    * <code bash>yum install spacecmd</code>
  
 ---- ----
Line 18: Line 32:
 Create the file ~/.spacecmd/config Create the file ~/.spacecmd/config
 <code bash> <code bash>
 +mkdir ~/.spacecmd
 +chmod 700 ~/.spacecmd
 +touch ~/.spacecmd/config
 +chmod 600 ~/.spacecmd/config
 +</code>
 +
 +Edit the file
 +<code bash>
 +vim ~/.spacecmd/config
 +
 [spacecmd] [spacecmd]
 server=spacewalkserver.mydomain.com server=spacewalkserver.mydomain.com
Line 24: Line 48:
 </code> </code>
  
-==== Useful Alias ====+Verify configuration by testing connectivity 
 +<code bash> 
 +spacecmd 
 +</code> 
 + 
 +---- 
 + 
 +===== Useful Alias =====
  
 It is also useful to create the following alias in your ~/.bashrc file It is also useful to create the following alias in your ~/.bashrc file
Line 32: Line 63:
  
 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. 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
 +<code bash>
 +spacecmd clear_caches
 +</code>
  
 ---- ----
Line 39: Line 81:
 List system groups List system groups
 <code bash> <code bash>
-spacecmd -q group_list+spacecmd group_list
 </code> </code>
  
 List systems in a group List systems in a group
 <code bash> <code bash>
-spacecmd -q group_listsystems <GROUP>+spacecmd group_listsystems <GROUP>
 </code> </code>
  
 Add systems to a group (SYSTEMS space separated) Add systems to a group (SYSTEMS space separated)
 <code bash> <code bash>
-spacecmd -q group_addsystems <GROUP> <SYSTEMS>+spacecmd group_addsystems <GROUP> <SYSTEMS>
 </code> </code>
  
 Remove systems from a group (SYSTEMS space separated) Remove systems from a group (SYSTEMS space separated)
 <code bash> <code bash>
-spacecmd -q group_removesystems <GROUP> <SYSTEMS>+spacecmd group_removesystems <GROUP> <SYSTEMS>
 </code> </code>
  
Line 61: Line 103:
 List all systems (good for piping to grep) List all systems (good for piping to grep)
 <code bash> <code bash>
-spacecmd -q system_list+spacecmd system_list
 </code> </code>
  
 Delete system(s) from Spacewalk (SYSTEMS space separated) Delete system(s) from Spacewalk (SYSTEMS space separated)
 <code bash> <code bash>
-spacecmd -q system_delete <SYSTEMS>+spacecmd system_delete <SYSTEMS>
 </code> </code>
  
 List a System's Base Channel List a System's Base Channel
 <code bash> <code bash>
-spacecmd -q system_listbasechannel <SYSTEM>+spacecmd system_listbasechannel <SYSTEM>
 </code> </code>
  
 List a System's Child Channels List a System's Child Channels
 <code bash> <code bash>
-spacecmd -q system_listchildchannels <SYSTEM>+spacecmd system_listchildchannels <SYSTEM>
 </code> </code>
  
 Set an entire group's base channel Set an entire group's base channel
 <code bash> <code bash>
-spacecmd -qy system_setbasechannel group:<GROUP-NAME> <BASE-CHANNEL-NAME>+spacecmd -system_setbasechannel group:<GROUP-NAME> <BASE-CHANNEL-NAME>
 </code> </code>
  
 List systems in a group and all errata except kernel: List systems in a group and all errata except kernel:
 <code bash> <code bash>
-spacecmd -q system_listerrata group:<GROUP-NAME> | grep -vi "kernel"+spacecmd system_listerrata group:<GROUP-NAME> | grep -vi "kernel"
 </code> </code>
  
 Errata install command: Errata install command:
 <code bash> <code bash>
-spacecmd -qy system_applyerrata group:<GROUP-NAME> <ERRATA-NAME>+spacecmd -system_applyerrata group:<GROUP-NAME> <ERRATA-NAME>
 </code> </code>
  
 List installed packages, grep for glibc: List installed packages, grep for glibc:
 <code bash> <code bash>
-spacecmd -q system_listinstalledpackages <SYSTEM>  | grep glibc+spacecmd system_listinstalledpackages <SYSTEM>  | grep glibc
 </code> </code>
  
Line 105: Line 147:
 Systems Not in Any Group Systems Not in Any Group
 <code bash> <code bash>
-spacecmd -q report_ungroupedsystems+spacecmd report_ungroupedsystems
 </code> </code>
  
-Query Ungrouped Systems and Put them in "NOGROUP" (For easier visibility)+Systems Not Checking In and Last Checkin Time
 <code bash> <code bash>
-for NODE in $(spacecmd -q report_ungroupedsystems) +spacecmd report_inactivesystems
-do echo "===> ${NODE}" +
-spacecmd -q group_addsystems NOGROUP $NODE +
-done 2>/dev/null+
 </code> </code>
  
-Systems Not Checking In and Last Checkin Time +----
-<code bash> +
-spacecmd -q report_inactivesystems +
-</code>+
  • linux_wiki/spacecmd_spacewalk_cmd_line.1444839374.txt.gz
  • Last modified: 2019/05/25 23:50
  • (external edit)