@@ -5,46 +5,72 @@ Convenient management and execution of command on groups of hosts : *A ssh loop
5
5
I created this tool more than one decade ago, because existing tools suck.
6
6
(Cluster Shell, Bolt, ... and probably because of NIH)
7
7
8
- # Install
9
-
10
- Software prerequisites:
11
- * rustc
12
- * ssh
13
- * screen
14
-
15
- Install script:
16
-
17
- On Ubuntu just do:
18
- ```
19
- INSTALLDIR="/opt/"
20
- sudo apt-get install rustc ssh screen
21
- cd ${INSTALLDIR?Installation Dir}
22
- git clone https://github.com/scoopex/hostctl.git hostctl
23
- cd hostctl
24
- cargo build --release
25
- ln -snf $INSTALLDIR/hostctl/target/release/hostctl /usr/local/bin/hostctl
26
- target/release/hostctl generate-completions bash > misc/hostctl_bash_completion.sh
27
- target/release/hostctl generate-completions zsh > misc/hostctl_zsh_completion.sh
28
- target/release/hostctl generate-completions fish > misc/hostctl_fish_completion.sh
29
- echo "source $INSTALLDIR/hostctl/misc/hostctl_bash_completion.sh" >> .bashrc
30
- exec bash
31
- ```
32
-
33
- Configure your environments:
34
-
35
- * Use the "ssh-agent"
36
- * Activate ssh agent forwarding (openssh: ` ForwardAgent yes ` ) on your desktop
37
- ssh client and all systems you want to use "hostctl"
38
- * Activate ssh agent-forwarding (openssh: ` AllowAgentForwarding yes ` , this should be the default value)
39
- on your ssh servers
40
-
41
- # Usage
8
+ # Install and use
9
+
10
+ 1 . Download ar current release from the [ releases page] ( https://github.com/scoopex/hostctl/releases )
11
+ 2 . Extract the archive
12
+ ``` bash
13
+ cd ${INSTALL_DIR?The installation base directory}
14
+ tar xvf hostctl-v0.9.11.tar.gz
15
+ ```
16
+ 3 . Add the tool to a directory which is in your PATH search-scope
17
+ ``` bash
18
+ cd ${INSTALL_DIR?The installation base directory} /hostctl
19
+ ln -snf $PWD /hostctl ~ /bin/hostctl
20
+ ```
21
+ 4 . Create directories
22
+ ```
23
+ mkdir -p ~/.hostctl/repices
24
+ ```
25
+ 5 . Configure your environments:
26
+ (See also "EXAMPLES" section)
27
+ ```
28
+ echo << 'EOF'
29
+ #<groupname> : <host>, <host>, ...
30
+ web2 : barfoo-l01-ap01, barfoo-l01-ap02, barfoo-l01-ap03, barfoo-l01-ap04, barfoo-l01-ap05, barfoo-l01-ap06
31
+ db2 : barfoo-l01-db01, barfoo-l01-db02, barfoo-l01-db03
32
+ EOF
33
+ ```
34
+ 6. Add shell completion to your shell init
35
+ (`~/.bashrc`, `~/.zshrc`)
36
+ ```
37
+ source ${INSTALL_DIR?The installation base directory}/hostctl_ $( basename $SHELL)_ completion.sh
38
+ ```
39
+ 6. Configure SSH
40
+ * Use the "ssh-agent"
41
+ * Activate ssh agent forwarding (openssh: `ForwardAgent yes`) on your desktop
42
+ ssh client and all systems you want to use "hostctl"
43
+ * Activate ssh agent-forwarding (openssh: `AllowAgentForwarding yes`, this should be the default value)
44
+ on your ssh servers
42
45
43
46
Invoke hostctl to execute commands or scripts on the specified hosts.
44
47
45
- See also "EXAMPLES" section.
48
+ # Develop
49
+
50
+ 1. Install software prerequisites:
51
+ ```
52
+ sudo apt-get install rustc ssh screen
53
+ ```
54
+ 2. Build it and add it to a directory which is in your PATH search-scope
55
+ ```
56
+ cd ${INSTALL_DIR?The installation base directory}/hostctl
57
+ git clone https://github.com/scoopex/hostctl.git hostctl
58
+ cd hostctl
59
+ cargo build --release
60
+ ln -snf ${INSTALL_DIR?The installation base directory}/hostctl/target/release/hostctl ~ /bin/hostctl
61
+ ```
62
+ 3. Build completions
63
+ ```
64
+ target/release/hostctl generate-completions bash > misc/hostctl_bash_completion.sh
65
+ target/release/hostctl generate-completions zsh > misc/hostctl_zsh_completion.sh
66
+ target/release/hostctl generate-completions fish > misc/hostctl_fish_completion.sh
67
+ echo "source $INSTALLDIR/hostctl/misc/hostctl_bash_completion.sh" >> .bashrc
68
+ exec bash
69
+ ```
70
+ 4. Execute step 4 and later in the previous section
71
+
72
+ # Help Output
46
73
47
- # Help
48
74
(output of "hostctl --help")
49
75
```
50
76
$ hostctl --help
@@ -122,29 +148,23 @@ Options:
122
148
123
149
# Configuration file format (hostctl.conf):
124
150
```
125
- #<perl-regex for visibility> : <groupname> : <host>, <host>, ...
126
- foobar-l01-(ap|db)\d+ : web1 : foobar-l01-ap01, foobar-l01-ap02, foobar-l01-ap03, foobar-l01-ap04, foobar-l01-ap05, foobar-l01-ap06
127
- foobar-l01-(ap|db)\d+ : db1 : foobar-l01-db01, foobar-l01-db02, foobar-l01-db03
128
-
129
- jump-barfoo : web2 : barfoo-l01-ap01, barfoo-l01-ap02, barfoo-l01-ap03, barfoo-l01-ap04, barfoo-l01-ap05, barfoo-l01-ap06
130
- jump-barfoo : db2 : barfoo-l01-db01, barfoo-l01-db02, barfoo-l01-db03
151
+ #<groupname > : <host >, <host >, ...
152
+ web2 : barfoo-l01-ap01, barfoo-l01-ap02, barfoo-l01-ap03, barfoo-l01-ap04, barfoo-l01-ap05, barfoo-l01-ap06
153
+ db2 : barfoo-l01-db01, barfoo-l01-db02, barfoo-l01-db03
131
154
```
132
155
133
- * Hostgroup web1 is only visible/usable on hosts which match to regex "foobar-l01-(ap|db)\d+" - i.e. foobar-l01-ap99
134
- * Hostgroup db1 is only visible/usable on hosts which match to regex "foobar-l01-(ap|db)\d+" - i.e. foobar-l01-ap99
135
156
* Hostgroup web2 is only visible/usable on host jump-barfoo
136
157
* Hostgroup db2 is only visible/usable on host jump-barfoo
137
158
138
159
139
160
# Missing features
140
161
162
+ - Implement completion of hosts and groups
141
163
- cluster shell mode with "--inscreen" : send STDIN of a master terminal to all screens
142
164
- packaging for rpm and deb
143
- - Show the next node on prompting
144
165
- Manual sorting of nodes
145
166
- Health check cmd for finishing the node
146
167
147
-
148
168
# Licence and Authors
149
169
150
170
Additional authors are very welcome - just submit your patches as pull requests.
0 commit comments