How to execute remote commands with Katello 2.3 and 2.4 on remote clients
http://theforeman.org/plugins/foreman_remote_execution/0.0/
Start by installing repository and EPEL7, see Quickstart instructions and Foreman manual for more information.
yum install ruby193-rubygem-foreman_remote_execution rubygem-smart_proxy_remote_execution_ssh
Note : the plugin only works if you satellite was install on RHEL7/Centos 7 for Katello
after that you going to have job
die() {
echo "${1}, exiting..."
exit $2
}
<% unless input("pre_script").blank? -%>
# Pre Script
<%= input("pre_script") %>
RETVAL=$?
[ $RETVAL -eq 0 ] || die "Pre script failed" $RETVAL
<% end -%>
<% if @host.operatingsystem.family == 'Redhat' -%>
yum -y <%= input("action") %> <%= input("package") %>
<% elsif @host.operatingsystem.family == 'Debian' -%>
apt-get -y <%= input("action") %> <%= input("package") %>
<% end -%>
RETVAL=$?
[ $RETVAL -eq 0 ] || die "Package action failed" $RETVAL
<% unless input("post_script").blank? -%>
# Post Script
<%= input("post_script") %>
RETVAL=$?
[ $RETVAL -eq 0 ] || die "Post script failed" $RETVAL
<% end -%>
Provider type:sshexecutorprovider
Name: pre-script
input type:user input
Name: package
input type:user input
Name: action
input type:user input
Name:post-script
input type:user input
with this you can deploy any command to the host via ssh as remote commands.
Comments
Post a Comment