All Projects β†’ psykulsk β†’ ansibleconnect

psykulsk / ansibleconnect

Licence: MIT license
Connect to all hosts from the inventory with one command

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to ansibleconnect

kube-plugins
a repository for plugins for kubernetes
Stars: ✭ 26 (+4%)
Mutual labels:  tmux, devops-tools
Awesome Ssh
πŸ’» A curated list of SSH resources.
Stars: ✭ 1,742 (+6868%)
Mutual labels:  ssh-agent, ssh-keys
wsl-agent-bridge
WSL compatibility bridge for ssh-agent on Windows
Stars: ✭ 17 (-32%)
Mutual labels:  ssh-agent, ssh-keys
Bridgy
cloud inventory + ssh + tmux + sshfs
Stars: ✭ 374 (+1396%)
Mutual labels:  tmux, inventory
Dot Files
⚑️ Well documented, terminal centric web developer's dot files. Neovim, Zsh, Tmux, Git, etc.
Stars: ✭ 209 (+736%)
Mutual labels:  tmux
Tmux Onedark Theme
A dark tmux color scheme inspired by Atom's One Dark syntax theme.
Stars: ✭ 183 (+632%)
Mutual labels:  tmux
Gitmux
πŸ’» Git in your tmux status bar
Stars: ✭ 180 (+620%)
Mutual labels:  tmux
Dotfiles
My [NeoVim + Tmux + Fish Shell] Setup /w install scripts
Stars: ✭ 180 (+620%)
Mutual labels:  tmux
Zsh Navigation Tools
Curses-based tools for Zsh, e.g. multi-word history searcher
Stars: ✭ 249 (+896%)
Mutual labels:  tmux
Dot
These are my dot files. I've primarily been a MacOS user for most of the time I've been collecting dotfiles, but I've recently switched to Linux. I primarily use Arch, Arco, Manjaro, or some other Arch based distro; so that's where I take my que.
Stars: ✭ 232 (+828%)
Mutual labels:  tmux
Slimux
SLIME inspired tmux integration plugin for Vim
Stars: ✭ 208 (+732%)
Mutual labels:  tmux
Dotfiles
My dotfiles: Experimental, ongoing configuration files, development environment and scripts for various Unix-like systems, text-based command-line applications and interfaces.
Stars: ✭ 185 (+640%)
Mutual labels:  tmux
Tmuxen
tmux environment made easy.
Stars: ✭ 222 (+788%)
Mutual labels:  tmux
Teamocil
There's no I in Teamocil. At least not where you think. Teamocil is a simple tool used to automatically create windows and panes in tmux with YAML files.
Stars: ✭ 2,179 (+8616%)
Mutual labels:  tmux
Dotfiles
😈 Vim, git, zsh, tmux, and other goodies.
Stars: ✭ 240 (+860%)
Mutual labels:  tmux
Fast Ide
πŸ•ΊFast Integrated Development Environment 😻
Stars: ✭ 181 (+624%)
Mutual labels:  tmux
Dotfiles
Ninrod's sharpened dotfiles for emacs, vim, zsh, tmux. Since '15.
Stars: ✭ 208 (+732%)
Mutual labels:  tmux
Tmux Fzf Url
πŸš€ Quickly open urls on your terminal screen!
Stars: ✭ 227 (+808%)
Mutual labels:  tmux
Tmux Gruvbox
Gruvbox color scheme for Tmux.
Stars: ✭ 204 (+716%)
Mutual labels:  tmux
.tmux
πŸ‡«πŸ‡· Oh my tmux! My self-contained, pretty & versatile tmux configuration made with ❀️
Stars: ✭ 15,594 (+62276%)
Mutual labels:  tmux

Ansibleconnect - connect to all hosts from the inventory with one command

Ansible Version CI Status
2.7 Ansible 2.7 Build Status
2.8 Ansible 2.8 Build Status
2.9 Ansible 2.9 Build Status
2.10 Ansible 2.10 Build Status

SSH into all hosts in your inventory with one command.

Ansibleconnect creates a bash script based on your ansible inventory. That script will create a new tmux window or session and create a separate pane for each one of your 'sshable' inventory hosts. Inside of each of the panes an ssh connection to the pane's host will be established.

Setup example (on Ubuntu):

sudo apt install tmux
sudo apt install sshpass
pip install ansibleconnect

Usage examples:

Connect to all hosts in inventory:

source <(ansibleconnect -i inventory.yml)

Connect to all hosts from group1 and group2:

source <(ansibleconnect -i inventory.yml -g 'group1:group2')

Connect to all hosts from group1 except for hosts that are also in group2:

source <(ansibleconnect -i inventory.yml -g 'group1:!group2')

Connect to all hosts from inventory except for hosts in group1:

source <(ansibleconnect -i inventory.yml -g '!group1')

Connect to all hosts that have AWS provider:

source <(ansibleconnect -i inventory.yml -vars provider:aws)>

NOTE: In case you don't use bash. You can also use eval command, for example:

eval "$(ansibleconnect -i inventories/inventory.yml)"

Possible flags

  • -i, --inventory - Path to ansible inventory
  • -g, --groups - Inventory groups of hosts to connect to (multiple groups should be concentrated with :. ! in front of group name means that ansibleconnect should not connect to hosts form this group). Example: -g computes:!storage
  • --hosts - List of hostnames to connect to. Example: --hosts hostA,hostB
  • -vars, --variables - Variables that host should have defined in inventory to connect to it. Accepted format: key:value in case where host should have variable with specific value or key in case where host should have defined variable no matter what value. Example: -v type:dev,team:ui
  • -novars, --no-variables - Variables that host should not have defined in inventory to connect to it. Accepted format: key:value in case where host should not have variable with specific value or key in case where host should not have defined variable no matter what value.Example: -novars type:prod,team:sales

Configuration

Ansibleconnect looks for the ansible.cfg file in the same locations as ansible.

Authentication

ssh-agent

For authentication one can use ssh keys. ansibleconnect will scan the inventory file for connection options (ansible_ssh_common_args, ansible_ssh_user, ansible_host, ansible_private_key_file, etc.). Ssh keys can be passed via them. Otherwise, one can use the ssh-agent tool. Environment args (SSH_AGENT_PID and SSH_AUTH_SOCK) will be passed to each one of the tmux shells.

ssh-agent setup example
eval $(ssh-agent)
ssh-add ~/.ssh/my_private_key.pem

sshpass

If ansible_ssh_pass variable is used in the inventory, one should install the sshpass and make it discoverable via PATH. Please note that when using the sshpass, password will passed in plaintext and it will be saved in each of the tmux shells' history.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].