Code Monkey home page Code Monkey logo

ansible-tty's Introduction

ansible-tty

open a ssh session with a defined host in an ansible inventory

Prerequisites

  • python 3.5 or greater
  • ansible 2.4 or greater
  • openssh client (present in most systems)

Tested in ubuntu, debian, alpine and arch linux, but should be work on almost linux systems

Install

clone the project and install it.

git clone https://github.com/alex-left/ansible-tty
cd ansible-tty
sudo python3 setup.py install

Or via pip:

pip3 install https://github.com/mrmilu/ansible-tty/archive/master.zip

Via docker

You can use the public image of docker:

docker pull mrmiludevops/ansible-tty

you should use it binding some read-only volumes, for example you maybe want access to your ssh keys or aws profiles and sure you will want read your ansible's inventory

docker run --rm -it \
-v $(pwd):/workdir:ro  \
-v $HOME/.ssh/:/root/.ssh/:ro \
-v $HOME/.aws/:/root/.aws/:ro \
mrmiludevops/ansible-tty -i [your inventory]

Also you can build you own image:

docker build -t ansible-tty .

Usage

usage: ansible-tty [-h] [-i INVENTORY] [hostname]

Init an ssh interactive terminal using ansible inventories

positional arguments:
  hostname              Try to filter and connect to the unique hostname

optional arguments:
  -h, --help            show this help message and exit
  -i INVENTORY, --inventory INVENTORY
                        use a specific ansible inventory
  • If no inventory is provided, ansible-inventory will try to load the default inventory
  • If no hostname is provided, the script will scan all hosts defined in inventory and will show an interactive dialog so you can choose one of them

TODO

  • configure more connectors than ssh (sshlxd, lxc, docker...)
  • use "ansible-eval" to get the real content of needed variables because the variables like "ansible_ssh_host" or "ansible_ssh_private_key_file" if have jinja syntax, ansible-inventories don't evaluate them
  • add some kind of tests

Contributing

All pull requests are welcome!

License

This project is licensed under GPL v3 licence - see the LICENSE file for details

ansible-tty's People

Contributors

alex-left avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.