| 1 |
Commands needed: |
| 2 |
conf/cmd/remote_exec |
| 3 |
conf/cmd/copy |
| 4 |
|
| 5 |
If ! conf/cmd/remote_exec: |
| 6 |
use builtin |
| 7 |
If ! conf/cmd/copy: |
| 8 |
use builtin |
| 9 |
|
| 10 |
-------------------------------------------------------------------------------- |
| 11 |
|
| 12 |
--cmd-dir? |
| 13 |
$__cdist_cmd_dir |
| 14 |
|
| 15 |
-------------------------------------------------------------------------------- |
| 16 |
-> Depend on session! |
| 17 |
|
| 18 |
Builtin: |
| 19 |
cdist.exec.run_or_fail(["scp", "-qr", source, |
| 20 |
self.remote_user + "@" + |
| 21 |
self.target_host + ":" + |
| 22 |
destination]) |
| 23 |
|
| 24 |
self.remote_prefix = ["ssh", self.remote_user + "@" + self.target_host] |
| 25 |
|
| 26 |
self.remote_user = remote_user |
| 27 |
self.remote_prefix = remote_prefix |
| 28 |
|
| 29 |
-------------------------------------------------------------------------------- |
| 30 |
What is in a session? |
| 31 |
|
| 32 |
base_dir |
| 33 |
target_host |
| 34 |
|
| 35 |
-------------------------------------------------------------------------------- |
| 36 |
remote_user |
| 37 |
pseudo-static, can be hardcoded again |
| 38 |
-------------------------------------------------------------------------------- |
| 39 |
|
| 40 |
Result: |
| 41 |
|
| 42 |
os.environ['__remote_exec'] = ["ssh", "-l", "root" ] |
| 43 |
|
| 44 |
os.environ['__remote_exec'] = ["ssh", "-o", "User=root" ] |
| 45 |
os.environ['__remote_copy'] = ["scp", "-o", "User=root" ] |
| 46 |
|
| 47 |
|
| 48 |
__remote_exec=~/sudossh __remote_copy=... cdist config localhost |
| 49 |
|
| 50 |
~/sudossh hostname $@... |
| 51 |
~/sudocopy a hostname:b |
| 52 |
|
| 53 |
~/chrootssh |
| 54 |
~/chrootcopy |
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
a) |
| 59 |
3 cmd verzeichnnise: cdist, sudo, chroot |
| 60 |
pro aufruf variable ändern |
| 61 |
|
| 62 |
b) |
| 63 |
1 dir, mit zeug |
| 64 |
pro aufruf variablen ändern |
| 65 |
|
| 66 |
|
| 67 |
conf/cmd/remote_exec |
| 68 |
|
| 69 |
args for __remote_exec |
| 70 |
$1 = hostname |
| 71 |
$2 - ... = stuff to be executed in /bin/sh on remote side |
| 72 |
$2 - $7 = env |
| 73 |
$7 - 12 = cmd |
| 74 |
|
| 75 |
|
| 76 |
args for __remote_copy |
| 77 |
$1 = file here |
| 78 |
$2 = hostname:destination |
| 79 |
|
| 80 |
-------------------------------------------------------------------------------- |
| 81 |
There needs to be an easy way to change those cmds! |
| 82 |
-------------------------------------------------------------------------------- |
| 83 |
Env-Passing: |
| 84 |
_a=b test -> test can access $_a |
| 85 |
_a=b test $_a -> $1 = "", because _a is *not* set within the shell |
| 86 |
_a=b; test -> can access $_a |
| 87 |
_a=b; test $_a -> $1 == "b" |