Ssh remote execution provider for Foreman Smart-Proxy
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.7
~> 1
~> 10.0
= 0.32.1

Runtime

 Project Readme

Build Status Gem Version Code Climate GPL License

Smart-proxy Ssh plugin

This a plugin for foreman smart-proxy allowing using ssh for the remote execution

Installation

Add this line to your smart proxy bundler.d/ssh.rb gemfile:

gem 'smart_proxy_dynflow', :git => 'https://github.com/theforeman/smart_proxy_dynflow.git'
gem 'smart_proxy_dynflow_core', :git => 'https://github.com/theforeman/smart_proxy_dynflow.git'
gem 'foreman_remote_execution_core', :git => 'https://github.com/theforeman/foreman_remote_execution.git'
gem 'smart_proxy_remote_execution_ssh', :git => 'https://github.com/theforeman/smart_proxy_remote_execution_ssh.git'

Enable the plugins in your smart proxy:

cat > config/settings.d/dynflow.yml <<EOF
---
:enabled: true
EOF

cat > config/settings.d/remote_execution_ssh.yml <<EOF
---
:enabled: true
EOF

Install the dependencies

$ bundle

Usage

To configure this plugin you can use template from settings.d/remote_execution_ssh.yml.example. You must place remote_execution_ssh.yml config file (based on this template) to your smart-proxy config/settings.d/ directory.

Also, you need to have the dynflow plugin enabled to be able to trigger the tasks.

The simplest thing one can do is just to trigger a command:

curl http://my-proxy.example.com:9292/dynflow/tasks \
      -X POST -H 'Content-Type: application/json'\
      -d '{"action_name":  "ForemanRemoteExecutionCore::Actions::RunScript",
           "action_input": {"task_id" : "1234'$RANDOM'",
                            "script": "/usr/bin/ls",
                            "hostname": "localhost",
                            "effective_user": "root"}}'