Giter Site home page Giter Site logo

action-ssh's Introduction

GitHub Action - SSH Execute Commands

GitHub Action (yml) to execute SSH commands on remote server(s).

Supports:

  • Multiple hosts
  • Environment variables
  • Multiple commands
  • Private key authentication

Password authentication is generally seen as unsafe and is therefore not supported.

Example usage

Basic Example

- name: Execute SSH commmands on remote server
  uses: JimCronqvist/action-ssh@master
  with:
    hosts: '[email protected]'
    privateKey: ${{ secrets.PRIVATE_KEY }}
    command: ls -lah

Advanced Example - envs, multiple hosts, multiple commands

- name: Execute SSH commmands on remote server
  uses: JimCronqvist/action-ssh@master
  env:
    NAME: "Root"
  with:
    hosts: '[email protected] [email protected]:2222'
    privateKey: ${{ secrets.PRIVATE_KEY }}
    debug: false
    command: |
      ls -lah
      echo "I am $NAME"

Create your secrets here: https://github.com/USERNAME/REPO/settings/secrets

Inputs

command: Command(s) to execute on the remote server.

hosts: Hostname or IP address of the remote server(s). Separate multiple servers with a blank space. Example: "[email protected]:22 [email protected]:2222"

privateKey: The private key (id_rsa) content for authenticating to the SSH server(s). Recommended to store it as a GitHub Secret.

debug: Used to view all environment variables in the logs, please note that this could expose sensitive data. Default as false

Outputs

The output from the commands ran on the remote server(s).

External links

To set up ssh keys, please see the following guide: https://www.digitalocean.com/community/tutorials/how-to-set-up-ssh-keys-on-ubuntu-1804

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.