Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
linux_wiki:spacecmd_spacewalk_cmd_line [2015/04/17 17:01] billdozor |
linux_wiki:spacecmd_spacewalk_cmd_line [2016/03/21 22:13] billdozor [Spacecmd] |
||
---|---|---|---|
Line 3: | Line 3: | ||
**General Information** | **General Information** | ||
- | Spacewalk provides centralized management of Red Hat systems. | + | Spacewalk provides centralized management of Red Hat systems. |
+ | * Official Site: https:// | ||
+ | * Local Wiki Page: [[linux_wiki: | ||
+ | |||
+ | 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:// |
+ | * Other: | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== Install Spacecmd ===== | ||
+ | |||
+ | * Add spacewalk client repo | ||
+ | * CentOS 6<code bash>rpm -Uvh http:// | ||
+ | * CentOS 7<code bash>rpm -Uvh http:// | ||
+ | * Install spacecmd | ||
+ | * <code bash>yum install spacecmd</ | ||
---- | ---- | ||
Line 17: | Line 32: | ||
Create the file ~/ | Create the file ~/ | ||
<code bash> | <code bash> | ||
+ | mkdir ~/.spacecmd | ||
+ | chmod 700 ~/.spacecmd | ||
+ | touch ~/ | ||
+ | chmod 600 ~/ | ||
+ | </ | ||
+ | |||
+ | Edit the file | ||
+ | <code bash> | ||
+ | vim ~/ | ||
+ | |||
[spacecmd] | [spacecmd] | ||
server=spacewalkserver.mydomain.com | server=spacewalkserver.mydomain.com | ||
Line 23: | Line 48: | ||
</ | </ | ||
- | ==== Useful Alias ==== | + | Verify configuration by testing connectivity |
+ | <code bash> | ||
+ | spacecmd | ||
+ | </ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== 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 31: | 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 | ||
+ | </ | ||
---- | ---- | ||
Line 38: | Line 81: | ||
List system groups | List system groups | ||
<code bash> | <code bash> | ||
- | spacecmd | + | spacecmd group_list |
</ | </ | ||
List systems in a group | List systems in a group | ||
<code bash> | <code bash> | ||
- | spacecmd | + | spacecmd group_listsystems < |
</ | </ | ||
Add systems to a group (SYSTEMS space separated) | Add systems to a group (SYSTEMS space separated) | ||
<code bash> | <code bash> | ||
- | spacecmd | + | spacecmd group_addsystems < |
</ | </ | ||
Remove systems from a group (SYSTEMS space separated) | Remove systems from a group (SYSTEMS space separated) | ||
<code bash> | <code bash> | ||
- | spacecmd | + | spacecmd group_removesystems < |
</ | </ | ||
Line 60: | Line 103: | ||
List all systems (good for piping to grep) | List all systems (good for piping to grep) | ||
<code bash> | <code bash> | ||
- | spacecmd | + | spacecmd system_list |
</ | </ | ||
Delete system(s) from Spacewalk (SYSTEMS space separated) | Delete system(s) from Spacewalk (SYSTEMS space separated) | ||
<code bash> | <code bash> | ||
- | spacecmd | + | spacecmd system_delete < |
</ | </ | ||
List a System' | List a System' | ||
<code bash> | <code bash> | ||
- | spacecmd | + | spacecmd system_listbasechannel < |
</ | </ | ||
List a System' | List a System' | ||
<code bash> | <code bash> | ||
- | spacecmd | + | spacecmd system_listchildchannels < |
</ | </ | ||
Set an entire group' | Set an entire group' | ||
<code bash> | <code bash> | ||
- | spacecmd -qy system_setbasechannel group:< | + | spacecmd -y system_setbasechannel group:< |
</ | </ | ||
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 | + | spacecmd system_listerrata group:< |
</ | </ | ||
Errata install command: | Errata install command: | ||
<code bash> | <code bash> | ||
- | spacecmd -qy system_applyerrata group:< | + | spacecmd -y system_applyerrata group:< |
</ | </ | ||
List installed packages, grep for glibc: | List installed packages, grep for glibc: | ||
<code bash> | <code bash> | ||
- | spacecmd | + | spacecmd system_listinstalledpackages < |
</ | </ | ||
Line 104: | Line 147: | ||
Systems Not in Any Group | Systems Not in Any Group | ||
<code bash> | <code bash> | ||
- | spacecmd | + | spacecmd report_ungroupedsystems |
</ | </ | ||
- | Query Ungrouped | + | Systems |
<code bash> | <code bash> | ||
- | for NODE in $(spacecmd | + | spacecmd |
- | do echo " | + | |
- | spacecmd -q group_addsystems NOGROUP $NODE | + | |
- | done 2>/ | + | |
</ | </ | ||
- | Systems Not Checking In and Last Checkin Time | + | ---- |
- | <code bash> | + | |
- | spacecmd | + | |
- | </ | + |