Running Remote commands and Managing Files via Spacewalk

Running Remote commands and Managing Files via Spacewalk


Overview


In this article we are going to cover -

  • Run remote command.
  • Deploy file through Spacewalk.


Spacewalk Installation and Configuration


Please check my previous article for Spacewalk installation and configuration using the below link.

Spacewalk Installation and Configuration



Managing Spacewalk Channels and Repositories


Please check my previous article for Managing Spacewalk Channels and Repositories using the below link.

Managing Spacewalk Channels and Repositories



Spacewalk Client Installation and Register with Spacewalk Server


Please check my previous article for Spacewalk Client Installation and Registration with Spacewalk Server using the below link.

Spacewalk Client Installation and Register with Spacewalk Server



Run Remote Command


To Run the Remote Commands login to spacewalk dashboard and then go to Systems --> All --> Select the system from the list of systems.




Once we click on System then click on Remote Command.




As we seen above, we need to enable the Remote Command execution on the target system by installing the rhncfg-actions RPM as mentioned below.

# yum install rhncfg rhncfg-actions rhncfg-client

 
 


Now we will enable the remote command execution.

# rhn-actions-control –enable-all


With the --report option, we get the lists of remote actions that the client permits.

# rhn-actions-control --report
deploy is enabled
diff is enabled
upload is enabled
mtime_upload is enabled
run is enabled


Now click on Remote Command and type the commands which we want to execute on remote system.




Click on Events to check the System pending events.




Once the command is scheduled, we can check the same in the Schedule tab to check the status.






We can see above that the scheduled action is succeeded and after clicking on that we can check the output of command from the remote system.



 

Deploying file through spacewalk


For deploying file through spacewalk first we will create a configuration channel.


Go to Configuration --> Configuration Channels  --> Create Config Channel






Now creating a configuration file.




Now creating a file with the below content.




Now we will subscribe to the channel to which server it needs to be deployed.


Go to Systems  --> Configuration  --> Centrally-Managed-Channel Subscription






Now the file can be pulled from the client.

 

# rhncfg-client channels
Using server name spacewalk-server
Config channels:
Label            Name
-----            ----
change-motd      motd

[Before pull]

# cat /etc/motd


# ls -l /etc/motd
-rw-r--r--. 1 root root 0 Jun 7 2013 /etc/motd

 

[After pull]
# rhncfg-client get
Using server name spacewalk-server
Deploying /etc/motd


# ls -l /etc/motd
-rw-r--r--. 1 root root 236 Apr 22 14:27 /etc/motd

 

# cat /etc/motd
**********************************************************
*       This System is just for testing purpose          *
*       Client System with the Spacewalk server          *
**********************************************************


Now we can see that the motd file deployed successfully through Spacewalk.

That’s all for now. 


Leave a Reply

Your email address will not be published. Required fields are marked *