author | Mahlon E. Smith <mahlon@martini.nu> |
Mon, 02 Sep 2019 08:45:59 -0700 | |
changeset 14 | 07adc57ee2b0 |
parent 13 | 8e29e051b417 |
child 15 | 1332deddb45d |
permissions | -rw-r--r-- |
0
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1 |
|
14 | 2 |
symphony-ssh |
3 |
############ |
|
0
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4 |
|
14 | 5 |
Description |
6 |
------------ |
|
0
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7 |
|
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8 |
This is a small collection of base classes used for interacting with |
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9 |
remote machines over ssh. With them, you can use AMQP (via Symphony) to |
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
10 |
run batch commands, execute templates as scripts, and perform any |
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
11 |
batch/remoting stuff you can think of without the need of a separate |
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
12 |
client agent. |
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
13 |
|
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
14 |
These classes assume you have a user that can connect and login to |
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
15 |
remote machines using a password-less ssh keypair. They are not meant |
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
16 |
to be used directly. Subclass them! |
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
17 |
|
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
18 |
See the rdoc for additional information and examples. |
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
19 |
|
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
20 |
|
14 | 21 |
Options |
22 |
------- |
|
0
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
23 |
|
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
24 |
Symphony-ssh uses |
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
25 |
Configurability[https://rubygems.org/gems/configurability] to determine |
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
26 |
behavior. The configuration is a YAML[http://www.yaml.org/] file. |
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
27 |
|
11
ffa70066522c
Update for Ruby 2.5. Moderize configurability usage, update dependencies.
Mahlon E. Smith <mahlon@martini.nu>
parents:
2
diff
changeset
|
28 |
symphony: |
ffa70066522c
Update for Ruby 2.5. Moderize configurability usage, update dependencies.
Mahlon E. Smith <mahlon@martini.nu>
parents:
2
diff
changeset
|
29 |
ssh: |
ffa70066522c
Update for Ruby 2.5. Moderize configurability usage, update dependencies.
Mahlon E. Smith <mahlon@martini.nu>
parents:
2
diff
changeset
|
30 |
path: /usr/bin/ssh |
ffa70066522c
Update for Ruby 2.5. Moderize configurability usage, update dependencies.
Mahlon E. Smith <mahlon@martini.nu>
parents:
2
diff
changeset
|
31 |
user: root |
ffa70066522c
Update for Ruby 2.5. Moderize configurability usage, update dependencies.
Mahlon E. Smith <mahlon@martini.nu>
parents:
2
diff
changeset
|
32 |
key: /path/to/a/private_key.rsa |
ffa70066522c
Update for Ruby 2.5. Moderize configurability usage, update dependencies.
Mahlon E. Smith <mahlon@martini.nu>
parents:
2
diff
changeset
|
33 |
opts: |
ffa70066522c
Update for Ruby 2.5. Moderize configurability usage, update dependencies.
Mahlon E. Smith <mahlon@martini.nu>
parents:
2
diff
changeset
|
34 |
- -e |
ffa70066522c
Update for Ruby 2.5. Moderize configurability usage, update dependencies.
Mahlon E. Smith <mahlon@martini.nu>
parents:
2
diff
changeset
|
35 |
- none |
ffa70066522c
Update for Ruby 2.5. Moderize configurability usage, update dependencies.
Mahlon E. Smith <mahlon@martini.nu>
parents:
2
diff
changeset
|
36 |
- -T |
ffa70066522c
Update for Ruby 2.5. Moderize configurability usage, update dependencies.
Mahlon E. Smith <mahlon@martini.nu>
parents:
2
diff
changeset
|
37 |
- -x |
ffa70066522c
Update for Ruby 2.5. Moderize configurability usage, update dependencies.
Mahlon E. Smith <mahlon@martini.nu>
parents:
2
diff
changeset
|
38 |
- -o |
ffa70066522c
Update for Ruby 2.5. Moderize configurability usage, update dependencies.
Mahlon E. Smith <mahlon@martini.nu>
parents:
2
diff
changeset
|
39 |
- CheckHostIP=no' |
ffa70066522c
Update for Ruby 2.5. Moderize configurability usage, update dependencies.
Mahlon E. Smith <mahlon@martini.nu>
parents:
2
diff
changeset
|
40 |
- -o |
ffa70066522c
Update for Ruby 2.5. Moderize configurability usage, update dependencies.
Mahlon E. Smith <mahlon@martini.nu>
parents:
2
diff
changeset
|
41 |
- BatchMode=yes' |
ffa70066522c
Update for Ruby 2.5. Moderize configurability usage, update dependencies.
Mahlon E. Smith <mahlon@martini.nu>
parents:
2
diff
changeset
|
42 |
- -o |
ffa70066522c
Update for Ruby 2.5. Moderize configurability usage, update dependencies.
Mahlon E. Smith <mahlon@martini.nu>
parents:
2
diff
changeset
|
43 |
- StrictHostKeyChecking=no |
0
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
44 |
|
11
ffa70066522c
Update for Ruby 2.5. Moderize configurability usage, update dependencies.
Mahlon E. Smith <mahlon@martini.nu>
parents:
2
diff
changeset
|
45 |
**NOTE**: If you've upgrade from a version pre 0.2.0, the |
ffa70066522c
Update for Ruby 2.5. Moderize configurability usage, update dependencies.
Mahlon E. Smith <mahlon@martini.nu>
parents:
2
diff
changeset
|
46 |
Configurability path has changed from `symphony_ssh`, to an `ssh` key |
ffa70066522c
Update for Ruby 2.5. Moderize configurability usage, update dependencies.
Mahlon E. Smith <mahlon@martini.nu>
parents:
2
diff
changeset
|
47 |
under the `symphony` top level. |
0
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
48 |
|
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
49 |
|
14 | 50 |
### path |
0
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
51 |
|
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
52 |
The absolute path to the ssh binary. |
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
53 |
|
14 | 54 |
### user |
0
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
55 |
|
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
56 |
The default user to connect to remote hosts with. This can be |
11
ffa70066522c
Update for Ruby 2.5. Moderize configurability usage, update dependencies.
Mahlon E. Smith <mahlon@martini.nu>
parents:
2
diff
changeset
|
57 |
changed per connection in the AMQP payload. |
0
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
58 |
|
14 | 59 |
### key |
0
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
60 |
|
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
61 |
An absolute path to a password-less ssh private key. |
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
62 |
|
14 | 63 |
### opts |
0
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
64 |
|
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
65 |
SSH client options, passed to the ssh binary on the command line. Note |
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
66 |
that the defaults have been tested fairly extensively, these are just |
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
67 |
exposed if you have very specific needs and you know what you're doing. |
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
68 |
|
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
69 |
|
14 | 70 |
Installation |
71 |
------------- |
|
0
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
72 |
|
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
73 |
gem install symphony-ssh |
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
74 |
|
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
75 |
|
14 | 76 |
Contributing |
77 |
------------ |
|
0
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
78 |
|
14 | 79 |
You can check out the current development source with Mercurial |
80 |
[here](http://code.martini.nu/symphony-ssh), or via a mirror: |
|
81 |
||
82 |
* github: https://github.com/mahlonsmith/Symphony-SSH |
|
83 |
* SourceHut: https://hg.sr.ht/~mahlon/Symphony-SSH |
|
0
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
84 |
|
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
85 |
After checking out the source, run: |
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
86 |
|
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
87 |
$ rake |
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
88 |
|
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
89 |
This task will run the tests/specs and generate the API documentation. |
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
90 |
|
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
91 |
If you use {rvm}[http://rvm.io/], entering the project directory will |
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
92 |
install any required development dependencies. |
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
93 |
|
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
94 |
|
14 | 95 |
License |
96 |
------- |
|
0
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
97 |
|
11
ffa70066522c
Update for Ruby 2.5. Moderize configurability usage, update dependencies.
Mahlon E. Smith <mahlon@martini.nu>
parents:
2
diff
changeset
|
98 |
Copyright (c) 2014-2018, Mahlon E. Smith and Michael Granger |
0
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
99 |
All rights reserved. |
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
100 |
|
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
101 |
Redistribution and use in source and binary forms, with or without |
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
102 |
modification, are permitted provided that the following conditions are met: |
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
103 |
|
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
104 |
* Redistributions of source code must retain the above copyright notice, |
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
105 |
this list of conditions and the following disclaimer. |
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
106 |
|
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
107 |
* Redistributions in binary form must reproduce the above copyright notice, |
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
108 |
this list of conditions and the following disclaimer in the documentation |
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
109 |
and/or other materials provided with the distribution. |
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
110 |
|
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
111 |
* Neither the name of the author/s, nor the names of the project's |
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
112 |
contributors may be used to endorse or promote products derived from this |
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
113 |
software without specific prior written permission. |
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
114 |
|
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
115 |
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
116 |
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
117 |
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
118 |
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE |
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
119 |
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
120 |
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
121 |
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
122 |
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
123 |
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
124 |
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
125 |
|
aef8f9f4a788
Initial commit -- ssh base classes, converted from GroundControl and
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
126 |