AniNIX/Wiki#21 -- effecting renames for policy
This commit is contained in:
@@ -17,11 +17,11 @@ group=all
|
||||
offset=0
|
||||
unset inventory
|
||||
|
||||
function usage() {
|
||||
function usage() {
|
||||
# Show helptext
|
||||
# param retcode: what to exit
|
||||
retcode="$1"
|
||||
echo "Usage: $0 [ -o offset ] [-g group ] -i inventory.yml"
|
||||
echo "Usage: $0 [ -o offset ] [-g group ] [-i inventory.yml]"
|
||||
echo " $0 -h"
|
||||
echo "Group is optional -- add it if you only want to look at a specific subset."
|
||||
echo "Add -v for verbosity."
|
||||
@@ -41,7 +41,7 @@ function tmuxHosts() {
|
||||
name="$group-$offset"
|
||||
|
||||
# If no TMUX session started, then add one with four panes.
|
||||
if [ -z "$TMUX" ]; then
|
||||
if [ -z "$TMUX" ]; then
|
||||
tmux new-session -s "$name" -d "/bin/bash -l -c ssh\\ $host1"
|
||||
tmux select-window -t "$name":0
|
||||
tmux split-window "/bin/bash -l -c ssh\\ $host2"
|
||||
@@ -51,7 +51,7 @@ function tmuxHosts() {
|
||||
tmux setw synchronize-panes
|
||||
tmux a -d -t "$name"
|
||||
# Otherwise, add a new window to the current session with all four sessions.
|
||||
else
|
||||
else
|
||||
tmux new-window -n "$name" "/bin/bash -l -c ssh\\ $host1"
|
||||
tmux select-window -t "$name"
|
||||
tmux split-window "/bin/bash -l -c ssh\\ $host2"
|
||||
@@ -76,12 +76,11 @@ if [ "$(basename $0)" == "tmux-hosts" ]; then
|
||||
*) usage 1 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
|
||||
if [ -z "$inventory" ]; then
|
||||
echo Need an inventory.
|
||||
usage 2;
|
||||
inventory=$(grep -E ^inventory ~/.ansible.cfg | cut -f 2 -d '=')
|
||||
fi
|
||||
|
||||
|
||||
tmuxHosts $(ansible -i "$inventory" --list-hosts "$group"\
|
||||
| grep -v hosts\ \( \
|
||||
| sed 's/\s\+//g' \
|
||||
|
Reference in New Issue
Block a user