Skip to content

Instantly share code, notes, and snippets.

@erichs
Last active November 22, 2017 14:42
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save erichs/f113cc38fe498ab1704e to your computer and use it in GitHub Desktop.
Save erichs/f113cc38fe498ab1704e to your computer and use it in GitHub Desktop.
Papers, Please
    set :application, `basename $(pwd)`.chomp
    set :commit_sha, `git rev-parse --short "HEAD"`.chomp
    set :default_environment, {
      "RATIONALE_CLIENT" => "capistrano",
      "RATIONALE" => "'Deploying #{application} #{commit_sha}'"
    }
Dec 16 21:27:24 cdehost1 RATIONALE[46672]: event='ssh rationale' client='interactive-ssh' user='ops' ip='10.20.30.5' rationale='testing rationale' command="/bin/bash"
Dec 16 21:29:15 cdehost1 RATIONALE[46672]: event='ssh rationale' client='interactive-ssh' user='ops' ip='10.20.30.5' rationale='testing rationale' metric='111.011724' metric_units='seconds' description='session end'
Dec 16 21:30:33 cdehost2 RATIONALE[33096]: event='ssh rationale' client='ansible' user='ops' ip='10.20.30.5' rationale='gather ansible facts' command="/bin/sh -c '/usr/bin/python'"
Dec 16 21:30:34 cdehost2 RATIONALE[33096]: event='ssh rationale' client='ansible' user='ops' ip='10.20.30.5' rationale='gather ansible facts' metric='1.117183' metric_units='seconds' description='session end'
Dec 16 22:56:14 cdehost1 RATIONALE[14518]: event='ssh rationale' client='capistrano' user='dev' ip='10.20.30.6' rationale='Deploying app 2df726a' command="env RATIONALE_CLIENT=capistrano RATIONALE='Deploying\ app\ 2df726a' sh -c '/srv/app/bundle-exec rake assets:precompile'"
Dec 16 17:56:18 cdehost1 RATIONALE[14518]: event='ssh rationale' client='capistrano' user='dev' ip='10.20.30.6' rationale='Deploying app 2df726a' metric='4.852107' metric_units='seconds' description='session end'
user@devbox:~$ export RATIONALE="testing sendenv" RATIONALE_CLIENT="ad-hoc"
user@devbox:~$ ssh server

user@server:~$ echo $RATIONALE
testing sendenv

user@server:~$ echo $RATIONALE_CLIENT
ad-hoc

user@server:~$ ^D
$ ssh ops@cdehost
RATIONALE: _
@nogweii
Copy link

nogweii commented Jan 17, 2016

Do you think it would be possible to share the script you used for SSH's ForceCommand?

@herrbuerger
Copy link

Yes, such an interesting blog post, but the script would really help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment